| mesaj | a80ec5d | 2025-06-10 17:04:30 +0200 | [diff] [blame^] | 1 | # syntax=docker/dockerfile:1 |
| 2 | ####################################################################################### |
| 3 | # Copyright ETSI Contributors and Others. |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
| 14 | # implied. |
| 15 | # See the License for the specific language governing permissions and |
| 16 | # limitations under the License. |
| 17 | ####################################################################################### |
| 18 | |
| 19 | |
| 20 | ####################### |
| 21 | # Stage 1: Base stage # |
| 22 | ####################### |
| 23 | |
| 24 | FROM node:14-slim AS base |
| 25 | # placeholder |
| 26 | |
| 27 | FROM base AS deps |
| 28 | |
| 29 | WORKDIR /app |
| 30 | |
| 31 | COPY package*.json ./ |
| 32 | RUN npm i && \ |
| 33 | npm ci && \ |
| 34 | npm install -g @angular/cli@15.2.10 |
| 35 | |
| 36 | |
| 37 | ############################################################################################################################################################################### |
| 38 | |
| 39 | ######################## |
| 40 | # Stage 2: Build stage # |
| 41 | ######################## |
| 42 | |
| 43 | # Build stage |
| 44 | FROM base AS build |
| 45 | WORKDIR /app |
| 46 | |
| 47 | # IMPORTANT: Add node_modules to your .dockerignore file |
| 48 | # to avoid overwriting the node_modules from the deps stage. |
| 49 | COPY --from=deps /app/node_modules ./node_modules |
| 50 | COPY . . |
| 51 | RUN npm run build |
| 52 | |
| 53 | |
| 54 | ########################################################################################################################################################################## |
| 55 | |
| 56 | ########################## |
| 57 | # Stage 3: Runtime stage # |
| 58 | ########################## |
| 59 | |
| 60 | # Runtime stage |
| 61 | FROM nginx:alpine |
| 62 | WORKDIR /usr/share/nginx/html |
| 63 | |
| 64 | # Copy nginx config file |
| 65 | COPY --from=build /app/nginx/nginx.conf /etc/nginx/conf.d/default.conf |
| 66 | |
| 67 | # Cleaning up and copying static assets |
| 68 | RUN rm -rf ./* |
| 69 | COPY --from=build /app/dist/osm . |
| 70 | |
| 71 | EXPOSE 80 |
| 72 | |
| 73 | HEALTHCHECK --start-period=130s --interval=10s --timeout=5s --retries=12 \ |
| 74 | CMD curl --silent --fail localhost:80 || exit 1 |
| 75 | |
| 76 | |
| 77 | ENTRYPOINT ["nginx", "-g", "daemon off;"] |
| 78 | |