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
14 Replies
3 months ago
They are not.
Then this message needs to be changed for those cases:
[Region: europe-west4]
Cache mount ID is not prefixed with cache keyUnless this is documented somewhere
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.
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).
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.
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?
Yeah, I understand that's a possibility, but it's double maintenance just for the sake of a single provider.
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