fix build time environment variables

This commit is contained in:
SennayT
2026-06-06 07:49:20 +00:00
parent 2ef05d2dd7
commit 7390b6fc31
3 changed files with 7 additions and 3 deletions

View File

@@ -60,7 +60,7 @@ services:
args: args:
APP_PACKAGE: "@edr/passenger-portal" APP_PACKAGE: "@edr/passenger-portal"
APP_PATH: apps/edr-passenger-web/portal APP_PATH: apps/edr-passenger-web/portal
NEXT_PUBLIC_API_URL: ${PASSENGER_NEXT_PUBLIC_API_URL:-http://localhost:4000} NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL:-http://localhost:4000}
secrets: secrets:
- npmrc - npmrc
ports: ports:
@@ -75,7 +75,7 @@ services:
args: args:
APP_PACKAGE: "@edr/passenger-backoffice" APP_PACKAGE: "@edr/passenger-backoffice"
APP_PATH: apps/edr-passenger-web/backoffice APP_PATH: apps/edr-passenger-web/backoffice
NEXT_PUBLIC_API_URL: ${PASSENGER_NEXT_PUBLIC_API_URL:-http://localhost:4000} NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL:-http://localhost:4000}
secrets: secrets:
- npmrc - npmrc
ports: ports:

View File

@@ -14,7 +14,7 @@
ARG APP_PACKAGE=@edr/passenger-portal ARG APP_PACKAGE=@edr/passenger-portal
ARG APP_PATH=apps/edr-passenger-web/portal ARG APP_PATH=apps/edr-passenger-web/portal
ARG PORT=5174 ARG PORT=5174
ARG NEXT_PUBLIC_API_URL=http://localhost:4000 ARG NEXT_PUBLIC_API_URL
FROM node:24.15.0-alpine AS base FROM node:24.15.0-alpine AS base
RUN apk add --no-cache libc6-compat RUN apk add --no-cache libc6-compat

View File

@@ -60,6 +60,10 @@ for service in "$@"; do
service_var=$(echo "${service}" | tr '[:lower:]-' '[:upper:]_') service_var=$(echo "${service}" | tr '[:lower:]-' '[:upper:]_')
echo "${service_var}_PORT=${port_value}" >> "${GITHUB_ENV}" echo "${service_var}_PORT=${port_value}" >> "${GITHUB_ENV}"
echo "Exported ${service_var}_PORT from ${src}" echo "Exported ${service_var}_PORT from ${src}"
# Forward NEXT_PUBLIC_* vars so docker compose build can inject them as build args.
grep -E '^[[:space:]]*NEXT_PUBLIC_[A-Za-z0-9_]+=' "${src}" \
| sed -E 's/^[[:space:]]*//' >> "${GITHUB_ENV}" || true
fi fi
done done