Does Railway inject env cars at build time?
shxkm
HOBBYOP

a year ago

Or only at runtime? I have a variable called SECRET_SNIPPET which is printing as None when the Dockerfile is building the image.

Solved

18 Replies

shxkm
HOBBYOP

a year ago

715a154f-c769-440d-9dad-373a1d7efafe


a year ago

Please see our docs on this topic -


shxkm
HOBBYOP

a year ago

But it’s considered unsafe to use secrets as ARG to Dockerfile?


a year ago

Not as far as I know.



a year ago

We only support ARG


shxkm
HOBBYOP

a year ago


a year ago

^


a year ago

This is a non-issue because the images do not leave our private registry.


shxkm
HOBBYOP

a year ago

It is an issue, also because there way too many of them to pass them one by one to the Dockerfile.

Do I have any other options here?


shxkm
HOBBYOP

a year ago

Are Railway’s VMs stateful, so I can maybe do the collectstatic stage at runtime?


a year ago

You only need to pass in the variables that you need during build; all variables are automatically injected at runtime.


a year ago

We don't use VMs at this time, but to persist files, you would need to store the files in a volume.


shxkm
HOBBYOP

a year ago

There are way too many of them in the case of Django which needs to import the settings.py file to do the collectstatic stage, which includes both secrets and regular ENV vars.


a year ago

Then you can try running that command at runtime.


shxkm
HOBBYOP

a year ago

Yeah, that fits what Railway does here:

https://github.com/railwayapp-templates/django/blob/main/railway.json

That sucks quite a bit since it will affect startup time, but I’ll try it I guess and see how bad it is.

I hope these issues raised here are propogated up, I’m really bummed I can’t use my Dockerfile as is with Railway and it makes me want to consider other alternatives to move to from Heroku.

Thanks for your help @Brody.


a year ago

It will effect startup time, but that would be a non-issue as long as you aren't using a volume and as long as you are using health checks.


a year ago

!s


Status changed to Solved brody 11 months ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...