chore: docker containers should honor environment variables #4756
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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."nx": {}
entry. This is required to be able to usenx
to run root/workspace level tasks. This is accomplished with nx exec. Note that onlytests-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 callsnx 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 callnx run uesio:build
, onlynx run uesio:tests-docker
(whereuesio
is the name of our root project via its name in package.json).Testing
ci & e2e will cover.