Skip to content

Commit

Permalink
Ensure .env files are visible on the build stage, and parse UI env va…
Browse files Browse the repository at this point in the history
…rs (#434)

Co-authored-by: Peter Wilson <[email protected]>
  • Loading branch information
javiermtorres and peteski22 authored Nov 25, 2024
1 parent 79974af commit f042bf5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ target/
.venv/
venv/

# Environment variable files
# ALLOW .env files
!.env

# PyCharm
.idea

Expand Down
9 changes: 8 additions & 1 deletion lumigator/frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ COPY ../../ /mzai

WORKDIR /mzai/

# Copy the .env file for the entire project, and perform some transformation on it.
# Only env vars starting with the 'VUE_APP_' prefix are made visible by the Vite build system (See: vite.config.js),
# but we extract only these variables in a kind of 'least privilege' way.
# See: https://cli.vuejs.org/guide/mode-and-env.html#environment-variables
COPY .env /mzai/lumigator/frontend/
RUN cat .env | grep -E ^VUE_APP_ > /mzai/lumigator/frontend/.env

# Install dependencies
RUN npm --prefix /mzai/lumigator/frontend install

Expand All @@ -17,7 +24,7 @@ RUN npm --prefix /mzai/lumigator/frontend run build
FROM nginx:1.27.2-alpine-slim AS server

# Copy built files to the Nginx image
COPY --from=base /mzai/lumigator/frontend/dist /usr/share/nginx/html
COPY --from=base /mzai/lumigator/frontend/dist /usr/share/nginx/html

# Copy a default nginx config, adjusted to support single page applications
COPY --from=base /mzai/lumigator/frontend/nginx.conf /etc/nginx/conf.d/default.conf
Expand Down

0 comments on commit f042bf5

Please sign in to comment.