git-webhook-ci/Dockerfile

29 lines
568 B
Docker

FROM golang:1.22 as builder
WORKDIR /app
# Copy the local package files to the container's workspace.
COPY go.mod go.sum ./
RUN go mod download
# Copy the project code into the container
COPY . .
# Build the Go app
RUN CGO_ENABLED=0 GOOS=linux go build -v -o git-webhook-ci
# Use a small Alpine Linux image
FROM alpine:latest
# Set the working directory
WORKDIR /root/
# Copy the binary from the builder stage
COPY --from=builder /app/git-webhook-ci .
# Document that the service listens on port 8080.
EXPOSE 8080
# Run the binary.
CMD ["./git-webhook-ci"]