Are bind mounts still not supported in Railway?
gustavovalverde
FREEOP

3 months ago

I've been optimizing a few Dockerfiles for size and rebuilding time; but it seems like bind mounts are either not supported, or the system is returning a misleading message.

Project: a86ddee5-5f77-4b8c-aad3-6100e3b7575e

Solved

14 Replies

3 months ago

They are not.


gustavovalverde
FREEOP

3 months ago

Then this message needs to be changed for those cases:

[Region: europe-west4]
Cache mount ID is not prefixed with cache key

Unless this is documented somewhere


3 months ago


gustavovalverde
FREEOP

3 months ago

So they are supported, based on the documentation. But you indicated they're not.


3 months ago

They've a different syntax, can you share your Dockerfile?


3 months ago

You asked if bind mounts are supported. They are not. Cache mounts are supported; they are different things.


gustavovalverde
FREEOP

3 months ago

Ok, it's just that I have 2 uses cases.

I'm working with cache mounts (combined with bind mounts) in a public repo, so base on the documentation I need to (1) expose the ID of my service publicly, and considering I'm hardcoding the prefix for Railway, (2) my Dockerfile also loses portability (multiple deployments would require their own Dockerfile with their ID set).

Unless the cache ID supports a build ARG (which I haven't done before).


gustavovalverde
FREEOP

3 months ago

So, this doc should indicate bind mounts are not supported.

And also that a Dockerfile is bound to a specific service (when using cache mounts). Unless you can do: --mount=type=cache,id=s/${RAILWAY_SERVICE_ID}-,target=


3 months ago

Environment variables can't be used in cache mount IDs, since that is invalid syntax.

My recommendation would be to forgo the mounts entirely and let us automatically handle the cache for you.


gustavovalverde
FREEOP

3 months ago

Surely, but that will only work for Railway, in other environments (like CI) this will cost me a lot of build time .


3 months ago

Have a Dockerfile.railway just for Railway?


gustavovalverde
FREEOP

3 months ago

Yeah, I understand that's a possibility, but it's double maintenance just for the sake of a single provider.


gustavovalverde
FREEOP

3 months ago

Thank you though, I now understand the limitations and I'll validate how to workaround those.


3 months ago

No Problem!


Status changed to Solved brody 3 months ago


Loading...