I have a multicontainer application that I would like to deploy and run within an Azure App Service. The compose file I have, docker-compose.prod.yml, contains environment variables (as shown in the below code).
When I run build the compose file locally, these variables are resolved during the build process by referencing an environment file (env.) located in the same directory:
docker-compose -f docker-compose.prod.yml build push
I know that it is possible to build a DevOps pipeline (as described here), which will insert environment variables during the build process, similar to how I build it locally.
However, I wanted to know if it is possible to either
1.) configure environment variables via the Azure Portal web interface (as you can do with application settings), which the docker compose file can then reference to resolve these variables on startup
or
2.) somehow upload the env. file I use locally which can then be used to resolve the variables on create or startup.
Contents of docker-compose.prod.yml
--------------------------------------------
version: '3.7'
services:
app1:
build: ./app1
command : python3 manage.py runserver 0.0.0.0:8000
ports:
- 8000:8000
image: "${AZ_CONTAINER_REGISTRY}/${APP1_IMAGE}:${APP1_VERSION}"
app2:
build: ./app2
command: python app.py
ports:
- 8081:8080
image: "${AZ_CONTAINER_REGISTRY}/${APP2_IMAGE}:${APP2_VERSION}"
restart: always
Contents of env. file
--------------------------------------------
AZ_CONTAINER_REGISTRY=sample.azurecr.io
APP1_IMAGE=app1test
APP1_VERSION=1.0
APP2_IMAGE=app2test
APP2_VERSION=2.0
Any feedback is appreciated, thanks