Update Dockerfile
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful

This commit is contained in:
sebclem 2023-07-18 11:07:28 +02:00
parent 81019dc330
commit 1dd881d2b5

View File

@ -1,27 +1,22 @@
# syntax=docker/dockerfile:1 # 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 WORKDIR /app
# Download Go modules
COPY go.mod go.sum ./ COPY go.mod go.sum ./
RUN go mod download 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 ./ COPY *.go ./
# Build
RUN CGO_ENABLED=0 GOOS=linux go build -o /woodpecker-config-service 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. FROM gcr.io/distroless/base-debian11 AS build-release-stage
# But we can document in the Dockerfile what ports
# the application is going to listen on by default. WORKDIR /
# https://docs.docker.com/engine/reference/builder/#expose COPY --from=build-stage /woodpecker-config-service /woodpecker-config-service
EXPOSE 8000 EXPOSE 8000
# Run
CMD ["/woodpecker-config-service"] CMD ["/woodpecker-config-service"]