File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change 11# ## STAGE 1: Build ###
2- # This image is around 50 megabytes
2+ # This image is around 53 megabytes
3+ # https://hub.docker.com/_/node/tags?page=1&name=alpine
34FROM node:18-alpine3.18 AS builder
45
56# Create app directory
@@ -14,19 +15,25 @@ RUN npm ci --verbose
1415# Build the ui
1516RUN npm run build
1617
17- # Create environment variable js file
18- RUN node generate-env-browser.js
19-
2018# ## STAGE 2: Run ###
2119# This image is around 5 megabytes
22- FROM nginx:1.25-alpine3.17-slim
20+ # https://hub.docker.com/_/nginx/tags?page=1&name=slim
21+ FROM nginx:1.25-alpine3.18-slim
22+
23+ # Install Node.js LTS version needed for env variable generation
24+ RUN apk add --update nodejs
2325
2426COPY /nginx /etc/nginx/conf.d
2527
2628EXPOSE 8080
2729EXPOSE 443
2830
31+ # Copy web application which was build in stage 1
2932COPY --from=builder /app/build /usr/share/nginx/html
30- COPY --from=builder /app/env-config.js /usr/share/nginx/html/
3133
32- # Nginx server will now start automatically.
34+ # Environment variables adjust the running environment
35+ COPY generate-env-browser.js /usr/share/nginx/html/generate-env-browser.mjs
36+ COPY .env .
37+
38+ # Start Nginx server with override ENV variables script
39+ CMD ["/bin/sh" , "-c" , "node /usr/share/nginx/html/generate-env-browser.mjs && nginx -g \" daemon off;\" " ]
You can’t perform that action at this time.
0 commit comments