Files
mtusi2026lab4/Dockerfile
T
2026-10-02 17:49:28 +03:00

39 lines
1022 B
Docker

FROM golang:1.26.5-alpine3.24 AS build
WORKDIR /src
COPY . .
RUN go build -o /out/messenger ./cmd/messenger
FROM build AS test
CMD ["go", "test", "./internal/postgres", "./internal/session"]
FROM swaggerapi/swagger-ui:v5.31.2 AS swagger
COPY contracts/openapi.json /spec/openapi.json
ENV SWAGGER_JSON=/spec/openapi.json
FROM prom/prometheus:v3.13.3 AS prometheus
COPY monitoring/prometheus.yml /etc/prometheus/prometheus.yml
FROM grafana/grafana:13.1.6 AS grafana
COPY monitoring/grafana/provisioning /etc/grafana/provisioning
COPY monitoring/grafana/dashboards /etc/grafana/dashboards
FROM nginx:1.30.5-alpine AS loadbalancer
COPY nginx/nginx.conf /etc/nginx/nginx.conf
FROM alpine:3.24.2
RUN addgroup -S app && adduser -S -G app -u 10001 app
COPY --from=build --chown=app:app /out/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"]