From 1dd881d2b5ca4c60559aed55ffece5a68348f71d Mon Sep 17 00:00:00 2001 From: sebclem Date: Tue, 18 Jul 2023 11:07:28 +0200 Subject: [PATCH] Update Dockerfile --- Dockerfile | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3e4634f..025fefe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,27 +1,22 @@ # syntax=docker/dockerfile:1 -FROM golang:1.20.5-alpine +FROM golang:1.20.5-alpine AS build-stage -# Set destination for COPY WORKDIR /app -# Download Go modules COPY go.mod go.sum ./ RUN go mod download -# Copy the source code. Note the slash at the end, as explained in -# https://docs.docker.com/engine/reference/builder/#copy COPY *.go ./ -# Build RUN CGO_ENABLED=0 GOOS=linux go build -o /woodpecker-config-service -# 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 + +FROM gcr.io/distroless/base-debian11 AS build-release-stage + +WORKDIR / +COPY --from=build-stage /woodpecker-config-service /woodpecker-config-service + EXPOSE 8000 -# Run CMD ["/woodpecker-config-service"] \ No newline at end of file