Builder using dockerfile over nix despite config path
There are a few things of context required. First, see #v2 Builder bug: uses nixpacks over dockerfile. When using the new builder in a subdirectory, the system uses nix over docker. I have different build for local and railway. Local uses a dockerfile and railway (for this subdirectory at least) uses nixpacks. As such, I have the config as code set to:
/frontend/nixpacks.toml
. Despite that, it still wants to use the docker image. (but doesn't becuase of the linked to thread).
Anyways, I have a Vite frontend that is built and then served by caddy. If I use the new builder and let it be built through nix, it works properly. But if I use the old one, it uses dockerfile.
There are some things going on here that might be a me issue. But I am not sure why despite giving it a config path, it still goes for the dockerfile. And even more so, why is it ignoring the config path for the nixpack? Is there a way to resolve this? As in, to more explicitly tell railway what to use for deployment? If not, I will just have to restructure my dockerfile to be usable with both local and prod. No big deal (probably).
If this is not a "bug" than I guess it becomes a feature request. A way to be more explicit on the builder stuff. Or is that already a thing and would just require me to add a railway.json
file?5 Replies
Project ID:
N/A
40943c2e-d9a8-4f3c-b414-73ea73eccd8f
Rip. I guess bot didn't pick it up becuase I changed the title?
I am so good at breaking things 😄
its not necessarily that the new builder uses nixpacks over docker, its that its not using the Dockerfile because of a bug and then it falls back to nixpacks.
the legacy builder will always use a Dockerfile if preset and there is no way to change that besides removing or renaming the Dockerfile, the v2 builder not doing that is a bug.
it sounds like you are quite comfortable with Dockerfiles, so then i would just forget about nixpacks entirely and stick to Dockerfiles,
a Dockerfile for railway and a dockerfile.dev for local.
Yea. I guess my post is framed in a strange way. Originally I thought I was running into a different issue. But the more I wrote, the more I figured out what parts were me just doing something dumb.
Also, in most cases (for me at least) the main difference between the dev and prod script, is just the final script. In docker that would be the CMD. In a dockerfile, CMD is just the default entry command. But you can very easily override it. So my current workflow is to have the prod CMD and then my local dev overrides it using a compose file. So I will continue to do that.
I say all of that, but in this case, I might actually need two different files.
Anyways, I guess it does stand that yea, I am requesting a way to specify a build script beyond just default to docker. I feel like there should be a way to override it. But I think I have seen that request before. So I guess I can just close this thread
you can tell railway what dockerfile to use in case you have it named another other than
Dockerfile
but if you do have it named Dockerfile
theres no way to stop railway from using it