update publish.yml and Dockerfile

This commit is contained in:
Dawid Wysokiński 2021-11-05 07:58:47 +01:00
parent c759587f22
commit df7f6709cc
Signed by: Kichiyaki
GPG Key ID: EF14026D247EB867
2 changed files with 6 additions and 3 deletions

View File

@ -39,8 +39,10 @@ jobs:
uses: docker/build-push-action@v2
with:
context: .
build-args: |
VERSION=v${{ steps.get_version.outputs.VERSION }}
tags: |
${{ secrets.REGISTRY_NAME }}/zdam-egzamin-zawodowy-backend:latest
${{ secrets.REGISTRY_NAME }}/zdam-egzamin-zawodowy-backend:${{ steps.get_version.outputs.VERSION }}
file: ./build/server/Dockerfile
push: true
push: true

View File

@ -11,9 +11,10 @@ RUN go mod download
# Copy the source from the current directory to the Working Directory inside the container
COPY ../.. .
ARG VERSION="v0.0.0"
RUN apk --no-cache add musl-dev gcc build-base
RUN go generate ./...
RUN go build -o zdamegzawodowy ./cmd/server
RUN go build -ldflags="-X 'main.Version=$VERSION'" -o zdamegzawodowy ./cmd/server
######## Start a new stage from scratch #######
FROM alpine:latest
@ -28,4 +29,4 @@ COPY --from=builder /app/zdamegzawodowy .
ENV APP_MODE=production
EXPOSE 8080
CMD ./wait && ./zdamegzawodowy
CMD ./zdamegzawodowy