From a80ec5d90437e6ab222fc1b4e34cf8297b4cef8b Mon Sep 17 00:00:00 2001 From: mesaj Date: Tue, 10 Jun 2025 17:04:30 +0200 Subject: [PATCH] Move Dockerfile from devops to the repo, base image Alpine Linux Change-Id: I8f7cba319cb13425dd88c67321aa8fdc7c4b0cd1 Signed-off-by: mesaj Signed-off-by: garciadeblas --- Dockerfile.production | 78 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Dockerfile.production diff --git a/Dockerfile.production b/Dockerfile.production new file mode 100644 index 0000000..eaa1cb7 --- /dev/null +++ b/Dockerfile.production @@ -0,0 +1,78 @@ +# 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;"] + -- 2.25.1