Docker build secret

hazmi35
FREE

a year ago

I have a Node.js application but I wanted to use my own Dockerfile. I need to use BuildKit's Build Secrets. How do I assign the build secret in railway builds?

2 Replies

hazmi35
FREE

a year ago

N/A


a year ago

the service variables are passed in as build args


hazmi35
FREE

a year ago

build args are a different thing


a year ago

then I'm sorry but you weren't clear in what you are asking



a year ago

ah gotcha, railway does not support this



maiertech
HOBBY

2 months ago

Is there a secure workaround or does it basically mean that I can't use a Dockerfile if I want to install an NPM package from a private registry, for instance?


maiertech

Is there a secure workaround or does it basically mean that I can't use a Dockerfile if I want to install an NPM package from a private registry, for instance?

Hey, if you want to use environment variables at build time in a Dockerfile, be sure to use it like this:

# Specify the variable you need

ARG RAILWAY_SERVICE_NAME

# Use the variable

RUN echo $RAILWAY_SERVICE_NAME

Be sure to declare your environment variables in the stage they are required in.


Docker build secret - Railway Help Station