R
Railway13mo ago
YoPassIt

Tell Nixpack to include public folder in build

I have an Axum build on Rust that is are web socket chat rooms, which also serves static files. When I run the cargo locally everything is fine, but when I deploy to railway the routes all work fine, except for the static file route which I can only tell doesn't work because the Nixpack isn't placing the public folder within the directory. Do I need to manually build a Docker Image, and if so how do I get Railway to use my Docker Image instead of generating a new Image.
28 Replies
Percy
Percy13mo ago
Project ID: N/A
YoPassIt
YoPassIt13mo ago
N/A
Brody
Brody13mo ago
are you sure you don't have that folder in a gitignore?
YoPassIt
YoPassIt13mo ago
yes all I had in the git ignore was target
Brody
Brody13mo ago
are you using relative paths when you serve this folder?
YoPassIt
YoPassIt13mo ago
I placed the public folder in src as well as externally Well in rust its from the crate level so relative to the crate yes
Brody
Brody13mo ago
looks like there's a chance nixpacks is running just the built binary in a slim image, so it's possible the public folder isn't being copied to the final image is it possible for you to just embed that folder into the binary?
YoPassIt
YoPassIt13mo ago
I believe thats the case. Its just html, css, and js so I have no idea
Brody
Brody13mo ago
it's not clear to me on how to stop nixpacks from doing that, so I propose two options, embed the folder into the binary or write a dockerfile to deploy your app
YoPassIt
YoPassIt13mo ago
If railway detects a Docker File it will use it automatically?
Brody
Brody13mo ago
yep!
YoPassIt
YoPassIt13mo ago
okay I'll get to it, by the way it may be wise to detech foldernames with static/public or other common static file folders and just load them into the build directory of the container
Brody
Brody13mo ago
hey you know rust (I don't) so I'm sure that would be a welcome PR (nixpacks is rust)
YoPassIt
YoPassIt13mo ago
Lol I would love to but I'm not confident in my rust at all. This is actually my first project in it. Just trying to deploy and show it off.
Brody
Brody13mo ago
fair enough
Want results from more Discord servers?
Add your server