Move Dockerfile from devops to the repo, base image Alpine Linux 18/15218/3 master
authormesaj <juanmanuel.mesamendez.ext@telefonica.com>
Tue, 10 Jun 2025 15:04:30 +0000 (17:04 +0200)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Thu, 9 Oct 2025 14:47:50 +0000 (16:47 +0200)
Change-Id: I8f7cba319cb13425dd88c67321aa8fdc7c4b0cd1
Signed-off-by: mesaj <juanmanuel.mesamendez.ext@telefonica.com>
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
Dockerfile.production [new file with mode: 0644]

diff --git a/Dockerfile.production b/Dockerfile.production
new file mode 100644 (file)
index 0000000..eaa1cb7
--- /dev/null
@@ -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;"]
+