forked from mtusi2026/mtusi2026lab2
25 lines
585 B
Docker
25 lines
585 B
Docker
FROM golang:1.26.5-alpine3.24 AS build
|
|
|
|
WORKDIR /src
|
|
COPY . .
|
|
RUN go build ./cmd/messenger
|
|
|
|
FROM build AS test
|
|
|
|
CMD ["go", "test", "./internal/postgres", "./internal/session"]
|
|
|
|
FROM build AS experiment
|
|
|
|
CMD ["go", "run", "./cmd/lab2experiment"]
|
|
|
|
FROM alpine:3.24.2
|
|
|
|
RUN addgroup -S app && adduser -S -G app -u 10001 app
|
|
COPY --from=build --chown=app:app /src/messenger /app/messenger
|
|
|
|
USER app
|
|
WORKDIR /app
|
|
HEALTHCHECK --interval=10s --timeout=2s --start-period=5s --retries=3 \
|
|
CMD wget -q -O /dev/null "http://127.0.0.1:${APP_PORT}/health/ready" || exit 1
|
|
CMD ["/app/messenger"]
|