Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
console-runner-image / build-runner-image (push) Has been cancelled
Signals CI & Image / signals-ci (push) Has been cancelled
Signals Reachability Scoring & Events / reachability-smoke (push) Has been cancelled
Signals Reachability Scoring & Events / sign-and-upload (push) Has been cancelled
41 lines
1.2 KiB
Docker
41 lines
1.2 KiB
Docker
# syntax=docker/dockerfile:1.7
|
|
# Multi-stage Angular console image with non-root runtime (DOCKER-44-001)
|
|
ARG NODE_IMAGE=node:20-bullseye-slim
|
|
ARG NGINX_IMAGE=nginxinc/nginx-unprivileged:1.27-alpine
|
|
ARG APP_DIR=src/Web/StellaOps.Web
|
|
ARG DIST_DIR=dist
|
|
ARG APP_PORT=8080
|
|
|
|
FROM ${NODE_IMAGE} AS build
|
|
ENV npm_config_fund=false npm_config_audit=false SOURCE_DATE_EPOCH=1704067200
|
|
WORKDIR /app
|
|
COPY ${APP_DIR}/package*.json ./
|
|
RUN npm ci --prefer-offline --no-progress --cache .npm
|
|
COPY ${APP_DIR}/ ./
|
|
RUN npm run build -- --configuration=production --output-path=${DIST_DIR}
|
|
|
|
FROM ${NGINX_IMAGE} AS runtime
|
|
ARG APP_PORT
|
|
ENV APP_PORT=${APP_PORT}
|
|
USER 101
|
|
WORKDIR /
|
|
COPY --from=build /app/${DIST_DIR}/ /usr/share/nginx/html/
|
|
COPY ops/devops/docker/healthcheck-frontend.sh /usr/local/bin/healthcheck-frontend.sh
|
|
RUN rm -f /etc/nginx/conf.d/default.conf && \
|
|
cat > /etc/nginx/conf.d/default.conf <<CONF
|
|
server {
|
|
listen ${APP_PORT};
|
|
listen [::]:${APP_PORT};
|
|
server_name _;
|
|
root /usr/share/nginx/html;
|
|
location / {
|
|
try_files $$uri $$uri/ /index.html;
|
|
}
|
|
}
|
|
CONF
|
|
|
|
EXPOSE ${APP_PORT}
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
|
CMD /usr/local/bin/healthcheck-frontend.sh
|
|
CMD ["nginx","-g","daemon off;"]
|