FROM alpine:3.24.2 AS security-test RUN apk add --no-cache curl openssl WORKDIR /src COPY scripts/test-tls-matrix.sh /src/scripts/test-tls-matrix.sh CMD ["/bin/sh", "/src/scripts/test-tls-matrix.sh"] FROM golang:1.26.10-alpine3.24 AS build ARG GOPROXY=https://proxy.golang.org WORKDIR /src ENV GOMAXPROCS=2 GOMEMLIMIT=1GiB RUN apk add --no-cache git COPY go.mod go.sum ./ RUN GOPROXY="$GOPROXY" go mod download COPY . . RUN go build -p=1 -o /out/messenger ./cmd/messenger RUN go build -p=1 -o /out/lab5experiment ./cmd/lab5experiment RUN go build -p=1 -o /out/mtlsproxy ./cmd/mtlsproxy 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 COPY monitoring/rules /etc/prometheus/rules FROM grafana/grafana:13.2.4 AS grafana COPY monitoring/grafana/provisioning /etc/grafana/provisioning COPY monitoring/grafana/dashboards /etc/grafana/dashboards FROM nginx:1.30.6-alpine AS loadbalancer RUN apk upgrade --no-cache COPY nginx/nginx.conf /etc/nginx/nginx.conf COPY nginx/upstream.conf /etc/nginx/conf.d/upstream.conf FROM alpine:3.24.2 RUN apk upgrade --no-cache && addgroup -S app && adduser -S -G app -u 10001 app COPY --from=build --chown=app:app /out/messenger /app/messenger COPY --from=build --chown=app:app /out/lab5experiment /app/lab5experiment COPY --from=build --chown=app:app /out/mtlsproxy /app/mtlsproxy 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:8082/health/ready" || exit 1 CMD ["/app/messenger"]