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
Project ID:
N/A
N/A
are you sure you don't have that folder in a gitignore?
yes all I had in the git ignore was target
are you using relative paths when you serve this folder?
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
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?
I believe thats the case.
Its just html, css, and js so I have no idea
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
If railway detects a Docker File it will use it automatically?
yep!
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
hey you know rust (I don't) so I'm sure that would be a welcome PR
(nixpacks is rust)
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.
fair enough