go-ical-ntfy-reminder/Dockerfile

31 lines
526 B
Docker
Raw Normal View History

2023-11-23 14:04:44 +01:00
# syntax=docker/dockerfile:1
# Build the application from source
FROM golang:1.21.4 AS build-stage
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY *.go ./
2023-11-23 17:26:07 +01:00
RUN CGO_ENABLED=0 GOOS=linux go build -o /main
2023-11-23 14:04:44 +01:00
# Run the tests in the container
FROM build-stage AS run-test-stage
RUN go test -v ./...
# Deploy the application binary into a lean image
FROM gcr.io/distroless/base-debian11 AS build-release-stage
WORKDIR /
2023-11-23 17:26:07 +01:00
COPY --from=build-stage /main /main
2023-11-23 14:04:44 +01:00
#EXPOSE 8080
USER nonroot:nonroot
2023-11-23 17:26:07 +01:00
ENTRYPOINT ["/main"]