The image_vars doesn't seems to work. When I try to use it, the Dockerfile can't see the values of t

The image_vars doesn't seems to work.
When I try to use it, the Dockerfile can't see the values of the build args.

For examle, this is how I setup my container inside wrangler.jsonc

        {
            "max_instances": 3,
            "name": "my-services-container",
            "class_name": "MyServicesContainer",
            "image": "./my-services-container/Dockerfile",
            "instance_type": "standard",
            "image_vars": {
                "NPM_TOKEN": "MY_NPM_TOKEN_SECRET"
            }
        }


In my Dockerfile I use

ARG NPM_TOKEN

# Install dependencies first
RUN npm install


The wrangler deploy fails on the npm install part: unauthenticated: User cannot be authenticated with the token provided.

However, when I set the token value manually inside my Dockerfile it works:

ARG NPM_TOKEN=MY_NPM_TOKEN_SECRET

# Install dependencies first
RUN npm install
Was this page helpful?