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]: build hexo fail- /bin/sh: 1: hexo: not found #1055

Closed Huangwh826 closed 1 year ago

Huangwh826 commented 1 year ago

Is there an existing issue for this?

Example public repository

coolify

Description

[19:42:28.688] Debug logging is disabled. Enable it above if necessary! [19:42:29.312] Cloning huangwh826/my-hexo:master... [19:42:32.104] Configuration changed [19:43:21.955] Building production image... [19:43:46.601] #1 [internal] load .dockerignore [19:43:46.621] #1 sha256:4210e0bf80e7641b58f920a7bc275458e7b4b262518b5da860ee53ebf7f9d619 [19:43:46.629] #1 transferring context: 2B 0.0s done [19:43:46.641] #1 DONE 0.0s [19:43:46.664] #2 [internal] load build definition from Dockerfile [19:43:46.667] #2 sha256:813beed128dd8c364b26b357ecadea7181ff405f3d4b61abb3ead980edb9dd14 [19:43:46.670] #2 transferring dockerfile: 215B done [19:43:46.672] #2 DONE 0.1s [19:43:46.676] #3 [internal] load metadata for docker.io/library/node:lts [19:43:46.679] #3 sha256:d292083fecdf88c05c7f542ce51888d7f5e3ec5d9e01de0c2be3b86532af0204 [19:43:46.682] #3 DONE 15.3s [19:43:46.685] #4 [1/6] FROM docker.io/library/node:lts@sha256:32605ead97ed57bd39a8a7b0e919240e1a3218974dfc6965e61b54a801753131 [19:43:46.689] #4 sha256:2501ea057ca5b4807d974a4a6b3a7db5ff3532872b809f497fc7f5365b85b221 [19:43:46.691] #4 DONE 0.0s [19:43:46.693] #5 [2/6] WORKDIR /app [19:43:46.695] #5 sha256:589d215eeab8ce2a527afe650a4a3a45a70f5f173018e6351ee410578dd9b2cd [19:43:46.697] #5 CACHED [19:43:46.701] #6 [internal] load build context [19:43:46.703] #6 sha256:ef5a9aec3e805f4cb9913201c4c354ded18a308db0c8d11dc210e1e18c8cc8c4 [19:43:46.704] #6 transferring context: 24B [19:43:46.707] #6 transferring context: 4.01MB 0.1s done [19:43:46.710] #6 DONE 0.2s [19:43:46.712] #7 [3/6] COPY . ./ [19:43:46.714] #7 sha256:a44e75862780856d559dc03ee3df645dc9230fef54c96f6b169f494454c74b6b [19:43:46.716] #7 DONE 0.1s [19:43:46.718] #8 [4/6] RUN npm install [19:43:46.720] #8 sha256:6150b909cdbc2ee5241e7c90dea9d3ecabb6c418bfbf70eabc9ae8dea23b8d6b [19:43:46.722] #8 4.157 npm WARN deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated [19:43:46.724] #8 6.791 npm WARN deprecated cuid@2.1.8: Cuid and other k-sortable and non-cryptographic ids (Ulid, ObjectId, KSUID, all UUIDs) are all insecure. Use @paralleldrive/cuid2 instead. [19:43:46.726] #8 8.401 [19:43:46.729] #8 8.401 added 240 packages, and audited 241 packages in 8s [19:43:46.730] #8 8.403 [19:43:46.732] #8 8.403 found 0 vulnerabilities [19:43:46.734] #8 8.404 npm notice [19:43:46.736] #8 8.404 npm notice New major version of npm available! 8.1.2 -> 9.6.5 [19:43:46.739] #8 8.404 npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.6.5 [19:43:46.741] #8 8.404 npm notice Run npm install -g npm@9.6.5 to update! [19:43:46.743] #8 8.404 npm notice [19:43:46.746] #8 DONE 8.5s [19:43:46.749] #9 [5/6] RUN hexo clean && hexo generate [19:43:46.751] #9 sha256:6ef71eca126e3b22a4c714611b20896cd8eaf1b5435d8f3d476b80df2271f1af [19:43:46.752] #9 0.324 /bin/sh: 1: hexo: not found [19:43:46.754] #9 ERROR: process "/bin/sh -c hexo clean && hexo generate" did not complete successfully: exit code: 127 [19:43:46.756] ------ [19:43:46.759] > [5/6] RUN hexo clean && hexo generate: [19:43:46.763] ------ [19:43:46.765] process "/bin/sh -c hexo clean && hexo generate" did not complete successfully: exit code: 127

Steps To Reproduce

1、create new resource --> application 2、select git repo 3、Select a Build Pack:node.js 4、Configuration image

Version

3.12.31

Huangwh826 commented 1 year ago

It can run on Vercel, but I encountered the above issues when trying to deploy on coolify

codesalatdev commented 1 year ago

@Huangwh826 that's not how npm works. The build command configured in coolify should be npm run build, not the contents of said script (hexo clean && hexo generate). You can also leave it empty, since coolify automatically runs the package's build script if configured (like Vercel). Start command should be npm run server. This is not an issue with coolify.

 => CACHED [1/5] FROM docker.io/library/node:lts@sha256:671ee8d49ce2a691fc3082203c5deb9522e0c80042aa0ff40c07f4a25e63668a                                 0.0s
 => [2/5] WORKDIR /app                                                                                                                                   0.1s
 => [3/5] COPY . /app                                                                                                                                    0.1s
 => [4/5] RUN npm install                                                                                                                                4.8s
 => ERROR [5/5] RUN hexo clean && hexo generate                                                                                                          0.6s
------                                                                                                                                                        
 > [5/5] RUN hexo clean && hexo generate:                                                                                                                     
#0 0.552 /bin/sh: 1: hexo: not found

VS

 => [1/5] FROM docker.io/library/node:lts@sha256:671ee8d49ce2a691fc3082203c5deb9522e0c80042aa0ff40c07f4a25e63668a                                        0.0s
 => CACHED [2/5] WORKDIR /app                                                                                                                            0.0s
 => [3/5] COPY . /app                                                                                                                                    0.3s
 => [4/5] RUN npm install                                                                                                                                4.6s
 => [5/5] RUN npm run build                                                                                                                              2.0s
 => exporting to image                                                                                                                                   2.6s 
 => => exporting layers                                                                                                                                  2.6s 
 => => writing image sha256:407a7710a9093337a5bb6a8f0649eb00ec2d723cc579ca4884f806296b48ff6b                                                             0.0s
Huangwh826 commented 1 year ago

@codesalatdev Thank you very much for solving my problem, using npm but not by default and hexo

npm install
npm run build
npm run server