The web app is contained and can be built from a Docker image, however, since image build and public deployment is being offloaded to Koyeb, we are building & storing the image with built-in ARGS and hosting in Docker Hub
The web app can be run either via:
- Docker compose config from the server directory
- Standalone app via own npm commands
Note: In practice, none of npm commands should be used directly since the webapp should be spawned via the server's docker compose which includes the environmental variables
-
npm run docker-build:localwill build a local docker container - Should probably never be used since local development is spawned using docker compose via the server repository -
npm run buildis used by the Dockerfile to build the app -
npm run docker-build:prodwill build the Docker image for thelatestbranch and push it to Docker Hub -
npm run docker-build:prodwill build the Docker image for thenextbranch and push it to Docker Hub -
npm run start:localwould run the webapp as a standalone app but there is no .env file since we are using docker
TODO -- Ideally there is hot module reload when running the webapp from docker compose
To use HMR, we are running the webapp service in Docker compose with vite build # FIX
Deployments are triggered by pushing or merging to next and latest branches.
When new code is pushed to either branch, Koyeb which will:
- Build the Docker Image using the DockerFile
- Inject the build ARGS at build time
- Deploy the app & make it accessible
Koyeb - easy to configure & serverless infrastructure running on AWS under the hood
The publicly available branches - next & latest - are served using Nginx in Koyeb
Since the webapp is being built with Vite - all environmental variables must be set as ARGS during build time
ARGS for deployments are set up in the Koyeb Project Configuration Environmental Variables configuration
Direct access to services in Koyeb:
An example list of env variables can be found in .env.example in the root directory