Skip to content

chore: docker containers should honor environment variables #4756

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 31, 2025

Conversation

techfg
Copy link
Collaborator

@techfg techfg commented Mar 30, 2025

What does this PR do?

Ensures that docker containers honor environment variables.

This is the next step towards standardizing build/run/test/etc. to start from a "common" environment. This is achieved via ensuring that nx runs all scripts/tasks as it will automatically load environment files if present.

This PR ensures that any core UESIO_* environment variables (e.g., UESIO_USE_HTTPS, PORT, UESIO_PRIMARY_DOMAIN, etc.) are used when building the container (e.g., npm run in-docker, npm run tests-docker, etc.).

Notes:

  1. there are still hardcoded https references in the code that require adjustment prior to everything working the way its intended using env variables as the starting point. To ensure backwards compat until these are addressed, all env vars have defaults in docker compose files if the env var is empty/not set.
  2. The package.json now contains an "nx": {} entry. This is required to be able to use nx to run root/workspace level tasks. This is accomplished with nx exec. Note that only tests-docker is included in root level tasks available. The reason for this is that by default, nx will include all npm scripts in root level tasks, however since the npm scripts use nx (e.g., "test" task calls nx run-many --target=test --all) this creates an infinite loop when nx attempts to serialize its graph. If npm script names were different than the target names, this would likely not be an issue. However, rather than refactor all the npm script names, simply restricting which takes are available on root to only the ones we want to expose avoids the issue. This is ultimately what we want anyway since we don't really want to be able to call nx run uesio:build, only nx run uesio:tests-docker (where uesio is the name of our root project via its name in package.json).

Testing

ci & e2e will cover.

@techfg techfg merged commit 51ec32a into main Mar 31, 2025
5 checks passed
@techfg techfg deleted the chore/refactor-docker-images branch March 31, 2025 05:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant