Copy a static folder on Nixpacks

a year ago

Might just be unable to read but - I have a /static directory at the root of my project. Upon building, it's no longer at the root - is there any way to config Nixpacks to copy this into the root of the container?

Thank you! 😅

Solved

46 Replies

a year ago

N/A


a year ago

I believe your app is always copied into the /app directory. You could add a cd instruction to your start command to change directory to that folder


a year ago

use ls to verify the folder contents


a year ago

Would that be something like this?

1333115507632767000


a year ago

Yeah I must be doing something wrong - cd app doesn't work as above, or as the custom start command. <:ferrisMelt:1286058037592719392>


a year ago

can you provide the error you are getting?


a year ago

For the nixpacks config deploy or the custom start command deploy?


a year ago

For the custom start command of cd app:

1333121276717437000


a year ago

remove the nixpacks config and your start command, let's start over


a year ago

Yep, done 😅


a year ago

okay now what error are you getting


a year ago

No error - everything runs fine, I just can't access the /static directory


a year ago

This is the path I'm using to open the file:

let file = File::open("static/changelog.md")?;

a year ago

what error


a year ago

"No such file or directory"


a year ago

I previously used this in a custom Dockerfile, but decided I'd try moving to Nixpacks since it was the only reason I had a custom Dockerfile 😅

1333123093560033300


a year ago

Dockerfile > Nixpacks


a year ago

Really?


a year ago

Dockerfiles give you far more control over your build


a year ago

I mean my Dockerfile was terrible - no caching, so it's 5 minute builds (on Rust) using the Dockerfile and 20 seconds on Nixpacks


a year ago

oh rust


a year ago

Yeah


a year ago

change your pre-deploy command to ls -la


a year ago

Huh

1333124047214612500


a year ago

lol


a year ago

do it via a railway.json file


a year ago

Something like this?

1333124523058528300


a year ago

yes


a year ago

Alright done - it's building now


a year ago

Also since it's definitely more relevant now - Project ID: 6fe4a25c-d387-4b3c-9e03-07bde35b7c5d


a year ago

why's it more relevant now


a year ago

1333125832696270800


a year ago

interesting


a year ago

Since the bot asks us for it whenever a help thread is created, I guess 😅


a year ago

Hm looks like it's navigating down to where the binary is stored


a year ago

can you try using an absolute path? /app/static/changelog.md


a year ago

Alright, I'll try that now


a year ago

Yeah, it's still a "No such file or directory"


a year ago

your app is being ran in a slim image, meaning no assets but the bin are copied


a year ago

Ahhhh, that makes sense


a year ago

Is there any way to change that?


a year ago

maybe, put this in a nixpacks.toml file -

[start]
    runImage = 'ubuntu:jammy'
    onlyIncludeFiles = ['./bin/the-sprongler', './static']

a year ago

You're an absolute lifesaver Brody - thank you so much for your help! <:shiba_heart:1017513599478005912>


a year ago

It works perfectly now 😄


a year ago

awsome!


a year ago

!s


Status changed to Solved brody • about 1 year ago


Loading...