blob: eaa1cb7af18d5f7ec2dd8ba8ae8bc458435f263d [file] [log] [blame]
# syntax=docker/dockerfile:1
#######################################################################################
# Copyright ETSI Contributors and Others.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#######################################################################################
#######################
# Stage 1: Base stage #
#######################
FROM node:14-slim AS base
# placeholder
FROM base AS deps
WORKDIR /app
COPY package*.json ./
RUN npm i && \
npm ci && \
npm install -g @angular/cli@15.2.10
###############################################################################################################################################################################
########################
# Stage 2: Build stage #
########################
# Build stage
FROM base AS build
WORKDIR /app
# IMPORTANT: Add node_modules to your .dockerignore file
# to avoid overwriting the node_modules from the deps stage.
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build
##########################################################################################################################################################################
##########################
# Stage 3: Runtime stage #
##########################
# Runtime stage
FROM nginx:alpine
WORKDIR /usr/share/nginx/html
# Copy nginx config file
COPY --from=build /app/nginx/nginx.conf /etc/nginx/conf.d/default.conf
# Cleaning up and copying static assets
RUN rm -rf ./*
COPY --from=build /app/dist/osm .
EXPOSE 80
HEALTHCHECK --start-period=130s --interval=10s --timeout=5s --retries=12 \
CMD curl --silent --fail localhost:80 || exit 1
ENTRYPOINT ["nginx", "-g", "daemon off;"]