Created
June 7, 2023 11:04
-
-
Save mshirdel/ee92593325e5cd53c9593006f641d316 to your computer and use it in GitHub Desktop.
DockerMultiStage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# syntax=docker/dockerfile:1 | |
FROM golang:1.20 AS build-stage | |
WORKDIR /app | |
COPY go.mod go.sum ./ | |
RUN go mod download | |
COPY . . | |
RUN CGO_ENABLED=0 GOOS=linux go build -o /linky | |
FROM gcr.io/distroless/base-debian11 AS build-release-stage | |
WORKDIR / | |
COPY --from=build-stage /linky /linky | |
COPY --from=build-stage /app/config-docker.yaml /config-docker.yaml | |
EXPOSE 8080 | |
USER nonroot:nonroot | |
CMD ["./linky", "migrate", "--config", "/config-docker.yaml"] | |
CMD ["./linky", "serve", "--config", "/config-docker.yaml"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment