build command with docker -f

bboynton97
PROOP

4 months ago

hello!

I'm changing one of my company's services. We have a dockerfile that needs to access a directory outside of the service dir to copy in some files. Instead of running the dockerfile in the service directory, I would like to run this command from the root dir.

however when i set this as the build command in the service settings, it fails because Docker is not installed. There is no nixpack or railpack that has docker installed by default. My understanding is that the only way to use a Dockerfile in Railway is if the Dockerfile is in the root dir, which in this case it is no longer.

I would love to be able to specify that Docker is a dependency prior to the build step. Or perhaps have a Docker nixpack option available instead of just specific languages.

As a workaround, I'm planning to write a script to install docker on the machine and THEN run the Dockerfile. But this is a hack and I'd love a more direct option built into railway.

Solved

3 Replies

Railway
BOT

4 months ago

Our team is working on getting back to you as soon as possible. In the meantime, we've found the following might help you get unlocked faster:

If you find the answer from one of these, please let us know by solving the thread! Otherwise, we’ll be in touch.


4 months ago

Hello,

Running Docker during build, even if possible, is not the solution here; that is simply not how builds on Railway work. We do the build with BuildKit ourselves and provide no way for the user to do that themselves.

We do allow higher level configurations, such as RAILWAY_DOCKERFILE_PATH - perhaps that is what you are looking for?

Best,
Brody


Status changed to Awaiting User Response Railway 5 months ago


bboynton97
PROOP

4 months ago

`RAILWAY_DOCKERFILE_PATH` did the trick! Considering that Dockerfiles are supported if in the root dir, it doesn't seem out of the question imo to be able to run your own docker build command. At least for this specific case, the env var worked for me! Appreciate the help, thank you!


Status changed to Awaiting Railway Response Railway 5 months ago


Status changed to Solved brody 5 months ago


Loading...