Serving an NX monorepo of angular apps in Docker-compose
TL;DR
ARG
's are build time variables. You can persist the ARG
's value in the images environment during the build or override the services[*].command
in the docker-compose.yaml
.
Persist in the environment
You can persist an environment variable set from a --build-arg
in the images environment during the build:
FROM alpine:3ARG APPENV APP=${APP}CMD echo $APP
Build the docker
image: docker build --rm --build-arg APP=123 -t so:66935830 .
Run the docker
container: docker run --rm -it so:66935830
Override the command
You can override the command
for each service in the docker-compose.yaml
:
version: '3.7'services: a: image: 'a' build: context: '.' command: ['echo', '123'] b: image: 'b' build: context: '.' command: ['echo', '456']