Files
mtusi2026lab5/Dockerfile
T

24 lines
809 B
Docker

FROM golang:1.27.3-bookworm@sha256:d9b6a1beb9474adc2a1ce842573639b44b2a0dd49b6669f51d3821baf9ec37c9 AS build
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY *.go ./
COPY migrations ./migrations
RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /messenger .
FROM python:3.13.18-slim-bookworm AS worker
RUN pip install --no-cache-dir --only-binary=:all: Pillow==13.0.0
COPY --from=build /messenger /messenger
COPY pipeline.py /pipeline.py
USER 65532:65532
STOPSIGNAL SIGTERM
ENTRYPOINT ["/messenger"]
FROM scratch AS api
COPY --from=build /messenger /messenger
USER 65532:65532
ENV APP_HOST=0.0.0.0 APP_PORT=8080 GOMEMLIMIT=256MiB
EXPOSE 8080
HEALTHCHECK --interval=5s --timeout=3s --start-period=10s --retries=3 CMD ["/messenger","healthcheck"]
STOPSIGNAL SIGTERM
ENTRYPOINT ["/messenger"]