How to pass values to ARG in Dockerfile with az containerapp up

dott-nagayama 65 Reputation points
2023-12-13T05:45:56.4466667+00:00

I want to change the ARG value in the Dockerfile for each environment such as 'staging' and 'production' using az containerapp up.

For example, assume the following Dockerfile.

I want to specify the value of NODE_ENV in the 'app containerapp'.

FROM node:20.9

WORKDIR /projects/app

COPY ./package.json ./
COPY ./package-lock.json ./

RUN npm ci --production

COPY . .

ARG NODE_ENV

RUN npm run build -- --configuration ${NODE_ENV}


Azure Container Apps
Azure Container Apps
An Azure service that provides a general-purpose, serverless container platform.
511 questions
0 comments No comments
{count} votes

Accepted answer
  1. Pramod Valavala 20,656 Reputation points Microsoft Employee
    2023-12-18T13:45:23.4833333+00:00

    @dott-nagayama Looks like the command does not support this today. It would best to raise a feature request on the repo for Azure CLI to support this scenario.

    That being said, this command internally uses ACR to build the image and the az acr build command supports passing build arguments. So, instead of using the az containerapp up command to build your image, you can first build it separately in your ACR and then call this command with the image name and registry details to create the containerapp.

    While you need two commands to achieve the same, the time taken should not really be different since the az containerapp up command does the same internally, albeit with less flexibility.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.