Summary
Update the Docker build process and GitHub Actions workflow to ensure environment awareness, so Nginx uses the correct configuration and redirects depending on the deployment environment.
Context & Requirements
- The Docker build process should be aware of the environment it's building for (e.g., production, dev, staging, test).
- The environment should be determined by the branch name in GitHub Actions (e.g., “production” for the production branch).
Requested Changes
- After the line:
COPY ./config/all/nginx/templates /etc/nginx/templates
…add logic to copy all individual files (not the directory) from ./config/{ENV}/nginx/templates/ (where {ENV} is the build environment) to /etc/nginx/templates/.
- If the directory
./config/{ENV}/nginx/templates/ does not exist, or there are no files in it, the build should fail gracefully with a clear message.
- The environment variable must be passed to the Docker build via the GitHub Actions workflow, based on the branch name.
- On the dev branch,
./config/dev/nginx/templates/ should be used (as an example, there is just one file to copy).
Goal
This enables Nginx to know what environment it is running in and to use appropriate redirects and configuration.
Summary
Update the Docker build process and GitHub Actions workflow to ensure environment awareness, so Nginx uses the correct configuration and redirects depending on the deployment environment.
Context & Requirements
Requested Changes
./config/{ENV}/nginx/templates/(where{ENV}is the build environment) to/etc/nginx/templates/../config/{ENV}/nginx/templates/does not exist, or there are no files in it, the build should fail gracefully with a clear message../config/dev/nginx/templates/should be used (as an example, there is just one file to copy).Goal
This enables Nginx to know what environment it is running in and to use appropriate redirects and configuration.