ci:build.api
The ci:build.api
builds a container image for the api service
that is intended to be used in production, or can be published as a new release.
Run npm run ci:build.api
in the root to trigger this script.
Under the hood, this will run:
Terminal
./scripts/ci-build-container.sh api
Publish the built image
This script takes an optional parameter publish
that will publish the newly
built image on docker hub:
Terminal
npm run ci:build.api publish
To make this work, the following environment variables should be available:
Name | Description |
---|---|
DOCKER_USERNAME | The username to authentication to the Docker registry |
DOCKER_PAT | The (personal access) token to authentication to the Docker registry |
Differences between development and production builds
This applies to the containers we build ourselves, not the ones we use as-is from upstream.
Container contents
- Development builds map the local source code in the container so you can make changes to the code running within without having to enter the container
- Production builds bundle the source code inside the container
Container entrypoint
- Development builds running NodeJS (api, core, ui) willrun in development mode where they automatically reload when changes are detected (using nodemon)
- Production containers use the PM2 process manager to run the NodeJS code
Run script prefix
- Development builds are triggered with run scripts with the
build:
prefix - Production builds are triggered with run scripts with the
ci:
prefix (as they are intended to run in )
Container namespace
- Development builds use the
morio
namespace (which cannot be published on Dockerhub) - Production builds use the
itsmorio
namespace
Builder
- Development builds are built using Docker's own BuildKit
- Production builds are built using Buildah as this avoids the need to access the Docker socket, which is often impossible in a environment.