11FROM node:20-alpine
22
3- # Install openssl for self-signed cert generation
3+ # openssl for TLS cert generation
44RUN apk add --no-cache openssl
55
66RUN addgroup -S andromeda && adduser -S andromeda -G andromeda
@@ -13,18 +13,23 @@ RUN cd backend && npm install --omit=dev
1313COPY backend/ ./backend/
1414COPY frontend/ ./frontend/
1515
16- # /data holds vault.enc AND certs/ — both owned by andromeda user
17- RUN mkdir -p /data/certs && chown -R andromeda:andromeda /data && \
18- chown -R andromeda:andromeda /app
16+ # /data is the persistent volume (vault + certs)
17+ # Set up ownership — volume mount will preserve this on fresh volumes
18+ RUN mkdir -p /data/certs && chown -R andromeda:andromeda /data /app
1919
2020USER andromeda
2121
22- EXPOSE 3000 3001
22+ # 3000 = HTTPS (main, exposed in compose)
23+ # 3002 = HTTP health-check (internal only, NOT exposed)
24+ EXPOSE 3000
2325
2426VOLUME ["/data" ]
2527
26- # Health check hits HTTPS — ignore cert verification
27- HEALTHCHECK --interval=30s --timeout=10s --start-period=20s --retries=3 \
28- CMD wget -qO- --no-check-certificate https://localhost:3000/api/health | grep -q '"status":"ok"' || exit 1
28+ # Health check hits the plain HTTP health server on 3002 (loopback only).
29+ # - No TLS → no --no-check-certificate needed (works with busybox wget)
30+ # - Starts immediately even before TLS cert is generated
31+ # - start-period=25s gives openssl time to run on first boot
32+ HEALTHCHECK --interval=30s --timeout=10s --start-period=25s --retries=3 \
33+ CMD wget -qO- http://127.0.0.1:3002/health | grep -q '"status":"ok"' || exit 1
2934
3035CMD ["node" , "backend/server.js" ]
0 commit comments