Skip to content

Commit

Permalink
PATH_TO_MAIN
Browse files Browse the repository at this point in the history
  • Loading branch information
mimimix committed Jan 15, 2024
1 parent a78c145 commit 3335f0d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,12 @@ jobs:
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME-${{ matrix.target }}
echo IMAGE_ID=$IMAGE_ID
PATH_TO_MAIN=./apps/${{ matrix.target }}
echo PATH_TO_MAIN=$PATH_TO_MAIN
docker build -f ./apps/${{ matrix.target }}/Dockerfile \
docker build -f $PATH_TO_MAIN/Dockerfile \
--build-arg PATH_TO_MAIN=$PATH_TO_MAIN
--tag $IMAGE_NAME \
.
Expand Down
14 changes: 8 additions & 6 deletions apps/pingserver/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,28 @@
FROM base:go_builder as builder

RUN apk update --no-cache && apk add --no-cache tzdata
ARG PATH_TO_MAIN=default_value

WORKDIR /build

ADD ./apps/pingserver/go.mod .
ADD ./apps/pingserver/go.sum .
ADD $PATH_TO_MAIN/go.mod .
ADD $PATH_TO_MAIN/go.sum .
RUN go mod download

COPY . .

ENV CGO_ENABLED 0
ENV GOOS linux

RUN go build -ldflags="-s -w" -o /app/main ./apps/pingserver/main.go
RUN go build -ldflags="-s -w" -o /app/main $PATH_TO_MAIN/main.go

FROM alpine

RUN apk update --no-cache && apk add --no-cache ca-certificates # && apk add --no-cache tzdata
RUN apk update --no-cache && apk add --no-cache ca-certificates

COPY --from=builder /usr/share/zoneinfo/America/New_York /usr/share/zoneinfo/America/New_York
COPY --from=builder /usr/share/zoneinfo/Europe/Moscow /usr/share/zoneinfo/Europe/Moscow

ENV TZ America/New_York
ENV TZ Europe/Moscow

WORKDIR /app

Expand Down

0 comments on commit 3335f0d

Please sign in to comment.