Relative path in railway.json file
I am trying to understand how relative paths work in
railway.json
file.
For example, if I have railway.json
and Dockerfile
file at ./packages/api
directory.
Does Railway will consider ./packages/api
as base directory? Will that be same for Dockerfile
as well?24 Replies
Project ID:
N/A
Will that be same for Dockerfile
as well?
If I want to copy the files only in ./packages/api
directory.
Will this work COPY . .
?in this scenario do you have a root directory set?
I don't see any property available on railway config to set a root directory.
https://railway.app/railway.schema.json
its in the service settings
ah! I see.
a follow up question
If I set a root directoy from the UI.
Will
railway.json
and Dockerfile
both respect this root directory?they should be, if they arent then thats a bug.
but this sounds like a shared monorepo, you wouldn't want to set any root directory for that kind of structure.
and in that case that means the base directory would be the root of the project
they should be, if they arent then thats a bug.Okie, I will try it.
but this sounds like a shared monorepo, you wouldn't want to set any root directory for that kind of structure.I trying to deploy micro-services, with all the code stored in a single repo and each micro-service has it's own
railway.json
and Dockerfile
.do these mico services share code with one another
nope (as of now)
I don't think you should be setting a root directory then, doing so may get you going now but could bite you in the butt later
oh! Can you please share a small example, how it could effect later?
Also, I tried setting the root directory from the UI
./packages/api
but then I was even for the railway.json file path in the UI.
I had to use full path ./packages/api/railway.json
.
Just by using railway.json
was failing the build.
Is this expected behaviour?setting a root directory will only copy in that directory, your code will not be able to access the code from other pages because it will not exist.
I had to use full path ... Is this expected behaviouryes, you need to specify the full path to the railway.json file
I had to use full path ... Is this expected behaviour yes, you need to specify the full path to the railway.json fileGotcha, thanks for confirmation. Should I submit a PR in railway docs to add this info?
im sure that would be a great addition
setting a root directory will only copy in that directory, your code will not be able to access the code from other pages because it will not exist.Interesting, that's definitely a valid point. I will keep that in mind. Thanks. On it.
added a review
I don't see any review/comments on the PR?
its 100% there
it's in pending state, you might have to submit that review. (i think that how it works in gh)
ill just send it here then lol -
Perhaps this would flow better -
same for the other place you added the text
updated 🙂
cool, im sure a team member will see it in the coming days
the PR was merged, but in the future please do not tag any team members, even if you see them active on github.