Copy a static folder on Nixpacks
maskddev
PROOP

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

maskddev
PROOP

a year ago

N/A


adam
MODERATOR

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


adam
MODERATOR

a year ago

use ls to verify the folder contents


maskddev
PROOP

a year ago

Would that be something like this?

1333115507632767000


maskddev
PROOP

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>


brody
EMPLOYEE

a year ago

can you provide the error you are getting?


maskddev
PROOP

a year ago

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


maskddev
PROOP

a year ago

For the custom start command of cd app:

1333121276717437000


brody
EMPLOYEE

a year ago

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


maskddev
PROOP

a year ago

Yep, done 😅


brody
EMPLOYEE

a year ago

okay now what error are you getting


maskddev
PROOP

a year ago

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


maskddev
PROOP

a year ago

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

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

brody
EMPLOYEE

a year ago

what error


maskddev
PROOP

a year ago

"No such file or directory"


maskddev
PROOP

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


brody
EMPLOYEE

a year ago

Dockerfile > Nixpacks


maskddev
PROOP

a year ago

Really?


brody
EMPLOYEE

a year ago

Dockerfiles give you far more control over your build


maskddev
PROOP

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


brody
EMPLOYEE

a year ago

oh rust


maskddev
PROOP

a year ago

Yeah


brody
EMPLOYEE

a year ago

change your pre-deploy command to ls -la


maskddev
PROOP

a year ago

Huh

1333124047214612500


brody
EMPLOYEE

a year ago

lol


brody
EMPLOYEE

a year ago

do it via a railway.json file


maskddev
PROOP

a year ago

Something like this?

1333124523058528300


brody
EMPLOYEE

a year ago

yes


maskddev
PROOP

a year ago

Alright done - it's building now


maskddev
PROOP

a year ago

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


brody
EMPLOYEE

a year ago

why's it more relevant now


maskddev
PROOP

a year ago

1333125832696270800


brody
EMPLOYEE

a year ago

interesting


maskddev
PROOP

a year ago

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


maskddev
PROOP

a year ago

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


brody
EMPLOYEE

a year ago

can you try using an absolute path? /app/static/[changelog.md](changelog.md)


maskddev
PROOP

a year ago

Alright, I'll try that now


maskddev
PROOP

a year ago

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


brody
EMPLOYEE

a year ago

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


maskddev
PROOP

a year ago

Ahhhh, that makes sense


maskddev
PROOP

a year ago

Is there any way to change that?


brody
EMPLOYEE

a year ago

maybe, put this in a nixpacks.toml file -

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

maskddev
PROOP

a year ago

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


maskddev
PROOP

a year ago

It works perfectly now 😄


brody
EMPLOYEE

a year ago

awsome!


brody
EMPLOYEE

a year ago

!s


Status changed to Solved brody • about 1 year ago


Loading...