D
Dokploy11mo ago
jdmry

Static site

hey, i'm deploying a react app, it's static, the build script builds the static site into /build directory, I can't manage to make that work for some reason. coolify has a tickbox to let it know if it's a static site but not sure what it does under the hood. any idea?
13 Replies
Siumauricio
Siumauricio11mo ago
Hey, can you share more details? 1. do you see any logs? 2. the build were succesfully?
jdmry
jdmryOP11mo ago
it's weird it builds correctly npm run build and succeed and the overall build succeed but then site is not available I feel like its not running the npm run start command for come reason, or at least I don't see the output in the deployment logs the log of the node is empty
Siumauricio
Siumauricio11mo ago
got it, can you share the package.json? you are using nixpacks?
jdmry
jdmryOP11mo ago
jdmry
jdmryOP11mo ago
using nix yes it build the app into the build directory and npm run start is supposed to serve the generatec static app from it on port 3000
Siumauricio
Siumauricio11mo ago
Can you show me the start of the log to see what commands nixpacks is using?
jdmry
jdmryOP11mo ago
I’ve overridden the install command via env var so it runs npm install —legacy-peers-dep (dependencies are a mess in this project lol) npm run build npm run start But maybe the app should run with serve as it’s serving a static app .. (I’ve tried to replace it but I don’t see it running anyway in the build log, like I don’t see running run start for some reason) ═════════════ Nixpacks v1.24.1 ═════════════╗ ║ setup │ nodejs_18, npm-9_x ║ ║─────────────────────────────────────────────║ ║ install │ npm install --legacy-peer-deps ║ ║─────────────────────────────────────────────║ ║ build │ npm run build ║ ║─────────────────────────────────────────────║ ║ start │ npm run start ║ ╚════════════════════════════════════════════
Siumauricio
Siumauricio11mo ago
everything seems right and in the logs there is empty?>
jdmry
jdmryOP11mo ago
actually it's not empty, it was empty after I tried some other things to fix, it looks like the app is running, it doesn't load in the browser though, but it's weird as it works in local and with coolify in static mode so I think it's more a problem with the way it runs as a static app, i'll dig a bit more browser console error that seems to be relevant Uncaught ReferenceError: process is not defined
𝗠𝗿𝟭𝗕𝗹𝗮𝘇𝗲
You can try to deploy not building files you can try all project because in nixpacks it will be automatically static
Siumauricio
Siumauricio11mo ago
I will take a look about this, looks like is possible with nixpacks https://nixpacks.com/docs/providers/staticfile
Staticfile | Nixpacks
App source + Nix packages + Docker = Image
jdmry
jdmryOP10mo ago
maybe I just need to make the build go to dist directory instead of build, and then nixpacks would just use that staticfile template 🙂 i'll try
Siumauricio
Siumauricio10mo ago
@jdmry Now you can deploy static applications with the new version!

Did you find this page helpful?