diff --git a/docker/Dockerfile b/docker/Dockerfile index 902f8e3f..20e59ac7 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,20 +1,19 @@ -FROM golang:1.21.5-alpine +FROM golang:1.23-bookworm AS builder -WORKDIR /app +WORKDIR /src + +COPY go.mod go.sum ./ +RUN go mod download -x -RUN apk update \ - && apk add --virtual build-deps gcc git \ - && rm -rf /var/cache/apk/* +COPY . ./ -RUN addgroup -S golang \ - && adduser -S -G golang golang +RUN GOOS=linux GOARCH=amd64 go build -o /bin/mailroom ./cmd/mailroom/*.go -COPY . . +FROM gcr.io/distroless/base-debian12 -RUN go install -v ./cmd/... -RUN chown -R golang /app +WORKDIR /app -USER golang +COPY --from=builder bin/mailroom ./ -EXPOSE 8080 -ENTRYPOINT ["courier"] +EXPOSE 8090 +ENTRYPOINT ["./courier"]