Skip to content
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

Improve environment variables #183

Open
olafveerman opened this issue May 8, 2018 · 2 comments
Open

Improve environment variables #183

olafveerman opened this issue May 8, 2018 · 2 comments

Comments

@olafveerman
Copy link
Contributor

The frontend is a statically built site. For the current offline use case, we build a Docker image that serves the site with nginx. The configuration is known in advance, and available when we build the image. When somebody runs docker-compose, the site is already fully built, and not aware of environment variables that may be set.

With the deployment through CloudFormation, not all configuration is known in advance (eg. the address of the API). We need to build the Docker image in such a way that environment variables can be used to set config.

Approach

Don't build the site in the pre-baked Docker image, instead build it when the container starts so it can pick up the env vars. To do:

  • add node + yarn to Docker container
  • include node modules in Docker image, so this doesn't have to be done when container launches
  • build the site when docker starts
@olafveerman
Copy link
Contributor Author

cc @danielfdsilva

@olafveerman
Copy link
Contributor Author

The above approach is implemented and works. The downside is that starting the container takes a long time. (1m+)
A future enhancement is to find a more elegant way to load the environment variables when the app starts. This would allow us to include a pre-built site in the Docker image and reduce launch time of the container.

@olafveerman olafveerman changed the title Environment variables on build Improve environment variables on build May 9, 2018
@olafveerman olafveerman changed the title Improve environment variables on build Improve environment variables May 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant