Does Railway inject env cars at build time?
shxkm
PROOP

7 months 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
PROOP

7 months ago

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


7 months ago

Please see our docs on this topic -


shxkm
PROOP

7 months ago

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


7 months ago

Not as far as I know.



7 months ago

We only support ARG


shxkm
PROOP

7 months ago


7 months ago

^


7 months ago

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


shxkm
PROOP

7 months 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
PROOP

7 months ago

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


7 months ago

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


7 months ago

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


shxkm
PROOP

7 months 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.


7 months ago

Then you can try running that command at runtime.


shxkm
PROOP

7 months 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.


7 months 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.


7 months ago

!s


Status changed to Solved brody 7 months ago


Loading...