This message was deleted.
s
This message was deleted.
b
@sticky-airline-40485 did you add
env
to your dockerfile too?
s
Hi @billowy-army-68599 thanks for your reply. I didn’t add any
ENV
to the Dockerfile. Is that the only way to set them in Pulumi?
b
that's a docker construct, the dockerfile doesn't know you're setting any environment variables at the moment. you might want to give this a read: https://vsupalov.com/docker-arg-env-variable-guide/
s
@billowy-army-68599 thanks mate, you're a legend! I was able to get it to work by adding the variables to the
args
,
Copy code
const image = repo.buildAndPushImage({
    context: '..', dockerfile: '../App/Dockerfile', args: {
        'ARG_ASPNETCORE_ENVIRONMENT': 'Dev',
        [...]
    }
})
And then then binding them in the
Dockerfile
Copy code
FROM base AS final
ARG ARG_ASPNETCORE_ENVIRONMENT
ENV ASPNETCORE_ENVIRONMENT=$ARG_ASPNETCORE_ENVIRONMENT
[...]
Thank you again for the guidance!