2020-04-27 15:21:03 +02:00
|
|
|
# stage1 as builder
|
2024-04-08 12:38:28 +02:00
|
|
|
FROM node:20-alpine AS builder
|
2020-04-27 15:21:03 +02:00
|
|
|
|
2024-04-08 12:38:28 +02:00
|
|
|
# copy the package.json to install dependencies
|
|
|
|
COPY package.json ./
|
|
|
|
|
|
|
|
# Install the dependencies and make the folder
|
2024-04-08 13:08:10 +02:00
|
|
|
RUN npm install && mkdir /src && mv ./node_modules ./src
|
2024-04-08 12:38:28 +02:00
|
|
|
|
|
|
|
WORKDIR /src
|
2020-04-27 15:21:03 +02:00
|
|
|
|
2022-09-13 09:35:56 +02:00
|
|
|
COPY . .
|
2020-04-27 15:21:03 +02:00
|
|
|
|
2024-04-08 12:38:28 +02:00
|
|
|
# Build the project and copy the files
|
2024-04-08 13:03:29 +02:00
|
|
|
RUN npm run ng build -- --configuration production
|
2024-04-08 12:38:28 +02:00
|
|
|
#RUN node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng build -- --deploy-url=/ --prod
|
2020-04-27 15:21:03 +02:00
|
|
|
|
|
|
|
FROM nginx:alpine
|
|
|
|
|
|
|
|
#!/bin/sh
|
|
|
|
|
2024-04-08 12:38:28 +02:00
|
|
|
COPY nginx.conf.CI /etc/nginx/conf.d/default.conf
|
|
|
|
COPY start_nginx.sh /start_nginx.sh
|
|
|
|
RUN mkdir -p /tmp/log/nginx
|
2022-09-13 09:35:56 +02:00
|
|
|
|
2020-04-27 15:21:03 +02:00
|
|
|
|
|
|
|
## Remove default nginx index page
|
2024-04-08 12:38:28 +02:00
|
|
|
RUN rm -rf /usr/share/nginx/html/*
|
2020-04-27 15:21:03 +02:00
|
|
|
|
2024-04-08 12:38:28 +02:00
|
|
|
# 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
|
2020-04-27 15:21:03 +02:00
|
|
|
|
2024-04-08 12:38:28 +02:00
|
|
|
EXPOSE 8080
|
|
|
|
ENTRYPOINT ["sh", "/start_nginx.sh"]
|