Skip to content
Snippets Groups Projects
Dockerfile 1 KiB
Newer Older
# Stage 0, based on Node.js, to build and compile Angular
FROM ${DEPENDENCY_PROXY}node:18.17-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 npm dependencies
RUN npm install --silent

# Copy the project
COPY angular.json .
COPY tsconfig.json .
COPY tsconfig.app.json .
Hugo SUBTIL's avatar
Hugo SUBTIL committed
COPY ngsw-config.json .
COPY /nginx/nginx.conf .
COPY /src ./src

ARG conf

# Building the Angular app /dist i18n
RUN npm run build:prod

# Stage 1, based on Nginx, to have only the compiled app
Etienne LOUPIAS's avatar
Etienne LOUPIAS committed
FROM ${DEPENDENCY_PROXY}nginxinc/nginx-unprivileged:1.25

# Copy nginx modified conf
COPY nginx/default.conf /etc/nginx/conf.d/default.conf
# copy artifact build from the 'build environment'
Hugo SUBTIL's avatar
Hugo SUBTIL committed
COPY --from=build /app/dist/fr /usr/share/nginx/html
# Add outdated browser page
ADD ./nginx/outdated.html /usr/share/nginx/html

Hugo SUBTIL's avatar
Hugo SUBTIL committed
RUN ls -l /usr/share/nginx/html
# expose port 8080
EXPOSE 8080
# run nginx
CMD ["nginx", "-g", "daemon off;"]