ops: add containers and monitoring

This commit is contained in:
2026-09-24 10:51:02 +03:00
parent 1f511728c9
commit dd3679a763
10 changed files with 369 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
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"]