coollabsio / coolify

An open-source & self-hostable Heroku / Netlify / Vercel alternative.
https://coolify.io
Apache License 2.0
35.04k stars 1.93k forks source link

[Bug]: Nixpacks build.sh not copied to `/artifacts` directory #3442

Open UltraSive opened 2 months ago

UltraSive commented 2 months ago

Description

Exec's into the build container

b69833603950:/artifacts/psoosg84s080w408kswsg48k/.nixpacks# ls
Dockerfile                                            build.sh                                              nixpkgs-e05605ec414618eab4a7a6aea8b38f6fbbcc8f08.nix
b69833603950:/artifacts/psoosg84s080w408kswsg48k/.nixpacks# cd ../../
b69833603950:/artifacts# ls
psoosg84s080w408kswsg48k  thegameplan.json

There is no /artifacts/build.sh like there is referenced in in the logs to start the build

/artifacts/build.sh: line 1: unexpected EOF while looking for matching `''

It appears there are some hidden steps to the build commands not shown in the deployment debug log, and it seemingly has a issue there.

Minimal Reproduction (if possible, example repository)

https://github.com/UltraSive/sveltekit-test

Exception or Error

Starting deployment of anchored-host/site-front:main to localhost.
Preparing container with helper image: ghcr.io/coollabsio/coolify-helper:1.0.1.
docker rm -f psoosg84s080w408kswsg48k
Error response from daemon: No such container: psoosg84s080w408kswsg48k
docker run -d --network coolify --name psoosg84s080w408kswsg48k --rm -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/coollabsio/coolify-helper:1.0.1
4cebb3cb9285ce85a86e59b661e460697a054bad574af7350b4761b1784e0154
docker exec psoosg84s080w408kswsg48k bash -c 'GIT_SSH_COMMAND="ssh -o ConnectTimeout=30 -p 22 -o Port=22 -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" git ls-remote [https://x-access-token:<REDACTED>@github.com/anchored-host/site-front.git](https://x-access-token:%3CREDACTED%3E@github.com/anchored-host/site-front.git) main'
038805399e46d95ffcce5c80b10e98b65d817410    refs/heads/main
Image not found (qkcok4cg4wwk4w44044kckoo:038805399e46d95ffcce5c80b10e98b65d817410). Building new image.
----------------------------------------
Importing anchored-host/site-front:main (commit sha 52d6c6fb8d25c362e462f890d5267e24d2b717cd) to /artifacts/psoosg84s080w408kswsg48k.
docker exec psoosg84s080w408kswsg48k bash -c 'git clone -b "main" [https://x-access-token:<REDACTED>@github.com/anchored-host/site-front.git](https://x-access-token:%3CREDACTED%3E@github.com/anchored-host/site-front.git) /artifacts/psoosg84s080w408kswsg48k && cd /artifacts/psoosg84s080w408kswsg48k && GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" git -c advice.detachedHead=false checkout 52d6c6fb8d25c362e462f890d5267e24d2b717cd >/dev/null 2>&1 && cd /artifacts/psoosg84s080w408kswsg48k && GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" git submodule update --init --recursive && cd /artifacts/psoosg84s080w408kswsg48k && GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" git lfs pull'
Cloning into '/artifacts/psoosg84s080w408kswsg48k'...
docker exec psoosg84s080w408kswsg48k bash -c 'cd /artifacts/psoosg84s080w408kswsg48k && git log -1 038805399e46d95ffcce5c80b10e98b65d817410 --pretty=%B'
test
Generating nixpacks configuration with: nixpacks plan -f toml --env NIXPACKS_NODE_VERSION=20 /artifacts/psoosg84s080w408kswsg48k
docker exec psoosg84s080w408kswsg48k bash -c 'nixpacks plan -f toml --env NIXPACKS_NODE_VERSION=20 /artifacts/psoosg84s080w408kswsg48k'
providers = []
buildImage = 'ghcr.io/railwayapp/nixpacks:ubuntu-1725321821'
[variables]
CI = 'true'
NIXPACKS_METADATA = 'node'
NIXPACKS_NODE_VERSION = '20'
NODE_ENV = 'production'
NPM_CONFIG_PRODUCTION = 'false'
[phases.build]
dependsOn = ['install']
cmds = ['npm run build']
cacheDirectories = ['node_modules/.cache']
[phases.install]
dependsOn = ['setup']
cmds = ['npm ci']
cacheDirectories = ['/root/.npm']
paths = ['/app/node_modules/.bin']
[phases.setup]
nixPkgs = [
    'nodejs_20',
    'npm-9_x',
    'openssl',
]
nixOverlays = ['https://github.com/railwayapp/nix-npm-overlay/archive/main.tar.gz']
nixpkgsArchive = 'e05605ec414618eab4a7a6aea8b38f6fbbcc8f08'
[start]
cmd = 'npm run start'
docker exec psoosg84s080w408kswsg48k bash -c 'nixpacks detect /artifacts/psoosg84s080w408kswsg48k'
node
Found application type: node.
If you need further customization, please check the documentation of Nixpacks: https://nixpacks.com/docs/providers/node
Final Nixpacks plan: {
    "providers": [],
    "buildImage": "ghcr.io\/railwayapp\/nixpacks:ubuntu-1725321821",
    "variables": {
        "SOURCE_COMMIT": "038805399e46d95ffcce5c80b10e98b65d817410",
        "CI": "true",
        "NIXPACKS_METADATA": "node",
        "NIXPACKS_NODE_VERSION": "20",
        "NODE_ENV": "production",
        "NPM_CONFIG_PRODUCTION": "false"
    },
    "phases": {
        "build": {
            "dependsOn": [
                "install"
            ],
            "cmds": [
                "npm run build"
            ],
            "cacheDirectories": [
                "node_modules\/.cache"
            ]
        },
        "install": {
            "dependsOn": [
                "setup"
            ],
            "cmds": [
                "npm ci"
            ],
            "cacheDirectories": [
                "\/root\/.npm"
            ],
            "paths": [
                "\/app\/node_modules\/.bin"
            ]
        },
        "setup": {
            "nixPkgs": [
                "nodejs_20",
                "npm-9_x",
                "openssl"
            ],
            "nixOverlays": [
                "https:\/\/github.com\/railwayapp\/nix-npm-overlay\/archive\/main.tar.gz"
            ],
            "nixpkgsArchive": "e05605ec414618eab4a7a6aea8b38f6fbbcc8f08",
            "aptPkgs": [
                "curl",
                "wget"
            ]
        }
    },
    "start": {
        "cmd": "npm run start"
    }
}
----------------------------------------
Building docker image started.
To check the current progress, click on Show Debug Logs.
docker exec psoosg84s080w408kswsg48k bash -c 'nixpacks build -c /artifacts/thegameplan.json --cache-key 'qkcok4cg4wwk4w44044kckoo' --no-error-without-start -n qkcok4cg4wwk4w44044kckoo:038805399e46d95ffcce5c80b10e98b65d817410 /artifacts/psoosg84s080w408kswsg48k -o /artifacts/psoosg84s080w408kswsg48k'
╔══════════════════ Nixpacks v1.28.0 ══════════════════╗
║ setup      │ nodejs_20, npm-9_x, openssl, curl, wget ║
║──────────────────────────────────────────────────────║
║ install    │ npm ci                                  ║
║──────────────────────────────────────────────────────║
║ build      │ npm run build                           ║
║──────────────────────────────────────────────────────║
║ start      │ npm run start                           ║
╚══════════════════════════════════════════════════════╝
Saved output to:
  /artifacts/psoosg84s080w408kswsg48k
docker exec psoosg84s080w408kswsg48k bash -c 'bash /artifacts/build.sh'
/artifacts/build.sh: line 1: unexpected EOF while looking for matching `''
Oops something is not okay, are you okay? 😢
/artifacts/build.sh: line 1: unexpected EOF while looking for matching `''
Deployment failed. Removing the new version of your application.

Version

v4.0.0-beta.335

Cloud?

djsisson commented 2 months ago

@UltraSive it builds fine, try deploy from a new project

UltraSive commented 2 months ago

@UltraSive it builds fine, try deploy from a new project

It's not about the actual repo I linked its rather than wherever I build using nixpacks it can't run the build.sh file like I described.

djsisson commented 2 months ago

I'm not following. The repo you linked did not have this issue it built fine using nixpacks there was no issue with the build.sh file

UltraSive commented 2 months ago

I'm not following. The repo you linked did not have this issue it built fine using nixpacks there was no issue with the build.sh file

It's not about the repo I linked, It's a problem with one of my projects having an issue with not generating the output for nixpacks correctly such that everything in that project wont build regardless of the git repo it's linked to. I'm pretty familiar with nixpacks as I use it every day building tekton pipelines so if I can find the issue I will and make a pull request, I just haven't been able to find the issue quite yet so I opened an issue here to make note of it.

chrsmlls333 commented 2 months ago

I'm having this experience too on beta332 and then beta335, with your minimal reproduction link and my own Astro deployment from a private Github deployment type. Attempted from a new resource/project multiple times.

Edit: also ran into the same build.sh error on trying to build from dockerfile.

andrasbacsai commented 2 months ago

I have a few ideas what could cause this. The next version (releasing today) probably fix it, but if not, I also added a build.sh content to the debug build logs in the next version.

Potential fix #3425

sunipan commented 2 months ago

This is happening to me with Next.js on beta347.

gilbertlucas46 commented 1 month ago

it's still an issue any github project I used (nixpacks)


Oops something is not okay, are you okay? 😢
2024-Oct-10 23:07:40.637830
/artifacts/build.sh: line 1: unexpected EOF while looking for matching `"'
2024-Oct-10 23:07:40.641056
Deployment failed. Removing the new version of your application.```

even the ones already deployed I can't redeploy them NOTE "no changes made" I just checked if it also gives an error
gilbertlucas46 commented 1 month ago

OMG, so for some reason when I deployed my site under project called API's it doesn't deploy.

djsisson commented 1 month ago

@gilbertlucas46 you cant use a single quote in project name

sunipan commented 1 month ago

I updated to beta360 and it works now, built my next.js app with Nixpacks just fine.