Newer
Older
# Stage 0, based on Node.js, to build and compile Angular

Hugo SUBTIL
committed
ARG DEPENDENCY_PROXY=
FROM ${DEPENDENCY_PROXY}node:20.18-slim AS build
WORKDIR /app
# Copy the package.json file first in order to cache the modules
COPY ./package.json .
COPY ./package-lock.json .
# Install exact versions of dependencies from package-lock.json (use "npm ci" instead of "npm install")
RUN npm ci --silent
COPY angular.json .
COPY tsconfig.json .
ARG conf
# Building the Angular app /dist i18n
# Stage 1, based on Nginx, to have only the compiled app
FROM ${DEPENDENCY_PROXY}nginxinc/nginx-unprivileged:1.25
# Copy nginx modified conf with template (cf. "Using environment variables in nginx configuration" in https://hub.docker.com/_/nginx )
COPY nginx/templates/default.conf.template /etc/nginx/templates/default.conf.template
# copy artifact build from the 'build environment'
# Add outdated browser page
ADD ./nginx/outdated.html /usr/share/nginx/html
# expose port 8080
EXPOSE 8080
# run nginx
CMD ["nginx", "-g", "daemon off;"]