diff --git a/frontend/.env.dev b/frontend/.env.dev index 8ceee2ba..7a2316ea 100644 --- a/frontend/.env.dev +++ b/frontend/.env.dev @@ -1,3 +1,3 @@ -RUN_CONFIG=dev +VITE_RUN_CONFIG=dev VITE_SERVER_URL_HTTP=http://localhost VITE_SERVER_URL_WS=ws://localhost:80 diff --git a/frontend/.env.prod b/frontend/.env.prod index 76e840a1..9831a4c0 100644 --- a/frontend/.env.prod +++ b/frontend/.env.prod @@ -1,3 +1,3 @@ -RUN_CONFIG=prod +VITE_RUN_CONFIG=prod VITE_SERVER_URL_HTTP=https://klinik-dps.de VITE_SERVER_URL_WS=wss://klinik-dps.de:443 diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 9b812a78..408f8f98 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -2,15 +2,17 @@ FROM node:latest LABEL authors="Wolkenfarmer, Joshua Riewesell" WORKDIR /app # set env vars to persist them in the image +ARG VITE_RUN_CONFIG ARG VITE_SERVER_URL_HTTP ARG VITE_SERVER_URL_WS -ENV VITE_SERVER_URL_HTTP=${VITE_SERVER_URL_HTTP} -ENV VITE_SERVER_URL_WS=${VITE_SERVER_URL_WS} RUN npm install -g vite RUN if [ "$RUN_CONFIG" = "prod" ]; then npm install -g serve; fi COPY package*.json ./ RUN npm install COPY . . +ENV VITE_RUN_CONFIG=${VITE_RUN_CONFIG} +ENV VITE_SERVER_URL_HTTP=${VITE_SERVER_URL_HTTP} +ENV VITE_SERVER_URL_WS=${VITE_SERVER_URL_WS} ENV PORT=5173 EXPOSE 5173 RUN if [ "$RUN_CONFIG" = "prod" ]; then npm run build-only; fi diff --git a/frontend/docker-compose.yml b/frontend/docker-compose.yml index d233c5ba..76278a55 100644 --- a/frontend/docker-compose.yml +++ b/frontend/docker-compose.yml @@ -8,9 +8,10 @@ services: args: - VITE_SERVER_URL_HTTP=${VITE_SERVER_URL_HTTP} - VITE_SERVER_URL_WS=${VITE_SERVER_URL_WS} + - VITE_RUN_CONFIG=${VITE_RUN_CONFIG} image: dps_training_k-frontend container_name: K-dPS-frontend env_file: - - .env.${RUN_CONFIG} + - .env.${VITE_RUN_CONFIG} ports: - "5173:5173"