From a71b85bb6b6acc0cec301c3d56a16e0d542f4181 Mon Sep 17 00:00:00 2001 From: amandilaras Date: Mon, 8 Apr 2024 13:38:28 +0300 Subject: [PATCH] update frontend dockerfile --- dmp-frontend/Dockerfile | 36 +++++++++++++++++++++--------------- dmp-frontend/Dockerfile.CI | 35 ----------------------------------- 2 files changed, 21 insertions(+), 50 deletions(-) delete mode 100644 dmp-frontend/Dockerfile.CI diff --git a/dmp-frontend/Dockerfile b/dmp-frontend/Dockerfile index 0bbd941a3..c29895831 100644 --- a/dmp-frontend/Dockerfile +++ b/dmp-frontend/Dockerfile @@ -1,29 +1,35 @@ # stage1 as builder -FROM node:20-alpine AS BUILDER +FROM node:20-alpine AS builder -WORKDIR /app - -# copy to install dependencies -COPY . . +# copy the package.json to install dependencies +COPY package.json ./ # Install the dependencies and make the folder -RUN npm install && npm run ng build -- --prod +RUN npm install && mkdir /src && mv ./node_modules ./src + +WORKDIR /src + +COPY . . + +# Build the project and copy the files +RUN npm run ng build -- --prod +#RUN node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng build -- --deploy-url=/ --prod FROM nginx:alpine #!/bin/sh -WORKDIR /usr/share/nginx/html +COPY nginx.conf.CI /etc/nginx/conf.d/default.conf +COPY start_nginx.sh /start_nginx.sh +RUN mkdir -p /tmp/log/nginx -COPY nginx.conf /etc/nginx -COPY mime.types /etc/nginx ## Remove default nginx index page -RUN rm -rf ./* +RUN rm -rf /usr/share/nginx/html/* -# Copy from the stahg 1 -COPY --from=BUILDER /app/dist . +# Copy from the stage 1 +COPY --from=builder /src/dist /usr/share/nginx/html +RUN cp /usr/share/nginx/html/index.html /usr/share/nginx/html/index_base.html -EXPOSE 4200 - -ENTRYPOINT ["nginx", "-g", "daemon off;"] +EXPOSE 8080 +ENTRYPOINT ["sh", "/start_nginx.sh"] diff --git a/dmp-frontend/Dockerfile.CI b/dmp-frontend/Dockerfile.CI deleted file mode 100644 index bc41c728c..000000000 --- a/dmp-frontend/Dockerfile.CI +++ /dev/null @@ -1,35 +0,0 @@ -# stage1 as builder -FROM node:20-alpine AS builder - -# copy the package.json to install dependencies -COPY package.json ./ - -# Install the dependencies and make the folder -RUN npm install && mkdir /src && mv ./node_modules ./src - -WORKDIR /src - -COPY . . - -# Build the project and copy the files -RUN npm run ng build -- --prod -#RUN node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng build -- --deploy-url=/ --prod - -FROM nginx:alpine - -#!/bin/sh - -COPY nginx.conf.CI /etc/nginx/conf.d/default.conf -COPY start_nginx.sh /start_nginx.sh -RUN mkdir -p /tmp/log/nginx - - -## Remove default nginx index page -RUN rm -rf /usr/share/nginx/html/* - -# Copy from the stage 1 -COPY --from=builder /src/dist /usr/share/nginx/html -RUN cp /usr/share/nginx/html/index.html /usr/share/nginx/html/index_base.html - -EXPOSE 8080 -ENTRYPOINT ["sh", "/start_nginx.sh"] \ No newline at end of file