forked from mtusi2026/mtusi2026lab7
ops: configure PKI and scoped OpenBao identities
This commit is contained in:
+19
-5
@@ -1,12 +1,23 @@
|
||||
FROM golang:1.26.5-alpine3.24 AS build
|
||||
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 go mod download
|
||||
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
|
||||
|
||||
@@ -27,19 +38,22 @@ 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.5-alpine AS loadbalancer
|
||||
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 addgroup -S app && adduser -S -G app -u 10001 app
|
||||
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:${APP_PORT}/health/ready" || exit 1
|
||||
CMD wget -q -O /dev/null "http://127.0.0.1:8082/health/ready" || exit 1
|
||||
CMD ["/app/messenger"]
|
||||
|
||||
Reference in New Issue
Block a user