commit 46d21898f1037fb600a441b159e3112ea83e12b7
parent 97a3bb8e3189cc5973bedc3caa1d436dc7fab0c9
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date: Sat, 28 Sep 2024 16:49:36 +0200
feat(myheats-nginx): update Dockerfile
Diffstat:
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/docker/docker-myheats-nginx/Dockerfile b/docker/docker-myheats-nginx/Dockerfile
@@ -1,14 +1,26 @@
-FROM docker.io/nginx:alpine
+FROM docker.io/nginx:alpine AS builder
# Read args from build command
ARG VITE_APP_DOC_TITLE='My Heats'
# use NODE_ENV=prod to exclude the `devDependencies` (e..g, vite)
# we require `vite` command in `npm run build` below
ARG NODE_ENV=dev
+ARG VITE_SESSION_TTL=3600
+ARG VITE_API_URI=https://api-myheats-demo.p0c.ch
+ARG VITE_API_PORT=443
+ARG VITE_WS_URI=wss://api-myheats-demo.p0c.ch
+ARG VITE_WS_PORT=443
+ARG VITE_LOCALE=de-CH
# Configure the env with the args
ENV VITE_APP_DOC_TITLE="$VITE_APP_DOC_TITLE"
ENV NODE_ENV="$NODE_ENV"
+ENV VITE_SESSION_TTL="$VITE_SESSION_TTL"
+ENV VITE_API_URI="$VITE_API_URI"
+ENV VITE_API_PORT="$VITE_API_PORT"
+ENV VITE_WS_URI="$VITE_WS_URI"
+ENV VITE_WS_PORT="$VITE_WS_PORT"
+ENV VITE_LOCALE="$VITE_LOCALE"
RUN apk update
RUN apk add --no-cache git npm
@@ -24,8 +36,10 @@ RUN npm ci
# https://vitejs.dev/guide/build
RUN npm run build
+FROM docker.io/nginx:alpine
+
# install the static files
RUN rm -rf /usr/share/nginx/html/*
-RUN cp -r dist/* /usr/share/nginx/html/
+COPY --from=builder dist/* /usr/share/nginx/html/
CMD ["nginx", "-g", "daemon off;"]