forked from mtusi2026/mtusi2026lab2
ops: add containers and monitoring
This commit is contained in:
+24
@@ -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"]
|
||||
Reference in New Issue
Block a user