Reputation: 59
I have a docker image that requires an ENV variable to start in the correct mode (eg. $ docker run -e "env_var_name=another_value" ...
). The Dockerfile starts with:
FROM nginx:alpine
ENV env_var_name standalone
In the Azure Devops release pipeline I use AzureRmWebAppDeployment@3 to create the docker container but I do not understand where I can do the ENV settings. I cannot use the .env file. many thanks
Upvotes: 2
Views: 1740
Reputation: 19
You can add it as AppSettings to the Application Service by setting up AzureRmWebAppDeployment task in the pipeline, here is a template YAML sample:
#11. Deploy web app
- task: AzureRMWebAppDeployment@4
displayName: Deploy web app on Linux container
inputs:
appType: webAppContainer
DockerImageTag: ${{ parameters.image_tag }}
DockerNamespace: ${{ parameters.registry_url }}
DockerRepository: ${{ parameters.repository_name }}
...
AppSettings: ${{ parameters.webapp_settings }}
example of webapp_settings values: webapp_settings: '-key1 "text" -key2 12 -otherKey 34'
App Settings are injected into your app as environment variables at runtime. (see here)
Upvotes: 2