feat: move to distroless docker image

This commit is contained in:
hgc 2024-02-11 13:42:26 +00:00
부모 06ff25d2b3
커밋 b5ffd0b493

파일 보기

@ -1,22 +1,11 @@
FROM golang:1.20
FROM golang:1.20 as build
# Set destination for COPY
WORKDIR /app
WORKDIR /go/src/app
COPY . .
# Copy the source code. Note the slash at the end, as explained in
# https://docs.docker.com/engine/reference/builder/#copy
COPY . ./
# Build
RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux go build -o /filehole
RUN CGO_ENABLED=0 go build -o /go/bin/filehole
# Optional:
# To bind to a TCP port, runtime parameters must be supplied to the docker command.
# But we can document in the Dockerfile what ports
# the application is going to listen on by default.
# https://docs.docker.com/engine/reference/builder/#expose
EXPOSE 8000
# Run
FROM gcr.io/distroless/static-debian12
COPY --from=build /go/bin/filehole /
CMD ["/filehole", "serve"]