railwayapp / nixpacks

App source + Nix packages + Docker = Image
https://nixpacks.com
MIT License
2.47k stars 232 forks source link

Bun support #960

Closed Screeper11 closed 11 months ago

Screeper11 commented 12 months ago

Feature request

Support Bun non-experimentally

Motivation

Bun is no longer in alpha, a confirmed stable support would be a good reason to migrate Bun projects over to Railway.

I think this would consist mostly of testing (and maybe bug fixing), rather than implementing a new feature as it seems to work most of the time already. But confirmation in the docs (after heavy testing) is needed to be able to trust Railway as a host of these projects.

Contribution

No response

marcfrankel commented 12 months ago

I'll add on to this issue that I just tried to use Bun on Railway and noticed that it installs version 0.4.0, not the new 1.0. It's causing a build fail for me

sinasab commented 12 months ago

+1 same issue, looks like there's a workaround (below, worked for me), but ideally this would "just work tm"

from the discord:

image

@ link

mrcnk commented 11 months ago

I'm facing a Next.js (with App Router) problem. Not sure if it isn't more of Bun issue though. It can't find next bin executable.

nixpacks build . --no-cache

╔══════ Nixpacks v1.15.0 ══════╗
║ setup      │ bun             ║
║──────────────────────────────║
║ install    │ bun i --no-save ║
║──────────────────────────────║
║ build      │ bun run build   ║
║──────────────────────────────║
║ start      │ bun run start   ║
╚══════════════════════════════╝

[+] Building 37.4s (12/14)                                             docker:desktop-linux
 => [internal] load build definition from Dockerfile                                   0.0s
 => => transferring dockerfile: 879B                                                   0.0s
 => [internal] load .dockerignore                                                      0.0s
 => => transferring context: 2B                                                        0.0s
 => [internal] load metadata for ghcr.io/railwayapp/nixpacks:ubuntu-1693872184         0.9s
 => [internal] load build context                                                      7.8s
 => => transferring context: 988.58MB                                                  7.8s
 => [ 1/10] FROM ghcr.io/railwayapp/nixpacks:ubuntu-1693872184@sha256:c90dd7da0f96190  0.0s
 => CACHED [ 2/10] WORKDIR /app/                                                       0.0s
 => [ 3/10] COPY .nixpacks/nixpkgs-c636fe7908e2b52713ff7c260a9da233effc5b7f.nix .nixp  0.5s
 => [ 4/10] RUN nix-env -if .nixpacks/nixpkgs-c636fe7908e2b52713ff7c260a9da233effc5b  17.7s
 => [ 5/10] COPY . /app/.                                                              3.1s
 => [ 6/10] RUN  bun i --no-save                                                       3.6s
 => [ 7/10] COPY . /app/.                                                              3.7s
 => ERROR [ 8/10] RUN  bun run build                                                   0.1s
------
 > [ 8/10] RUN  bun run build:
0.095 $ node_modules/.bin/next build
0.097 /bin/bash: line 1: node_modules/.bin/next: No such file or directory
0.097 error: script "build" exited with code 127
------
Dockerfile:24
--------------------
  22 |     # build phase
  23 |     COPY . /app/.
  24 | >>> RUN  bun run build
  25 |
  26 |
--------------------
ERROR: failed to solve: process "/bin/bash -ol pipefail -c bun run build" did not complete successfully: exit code: 127
Error: Docker build failed

More context: https://github.com/palladians/minaverse/pull/36

coffee-cup commented 11 months ago

Bun 1.0.2 support has been added in 1.15.0. If there is a bug or issue with a specific project, please open another issue

ctwhome commented 6 months ago

Bun 1.0.2 support has been added in 1.15.0. If there is a bug or issue with a specific project, please open another issue

That is fantastic thanks!, it would be useful to add a reference to Bunjs in your documentation, and also make it clear that to recognize a bun app, the directory needs the necessary files created in bun init.

blankart commented 2 months ago

I'm facing a Next.js (with App Router) problem. Not sure if it isn't more of Bun issue though. It can't find next bin executable.

nixpacks build . --no-cache

╔══════ Nixpacks v1.15.0 ══════╗
║ setup      │ bun             ║
║──────────────────────────────║
║ install    │ bun i --no-save ║
║──────────────────────────────║
║ build      │ bun run build   ║
║──────────────────────────────║
║ start      │ bun run start   ║
╚══════════════════════════════╝

[+] Building 37.4s (12/14)                                             docker:desktop-linux
 => [internal] load build definition from Dockerfile                                   0.0s
 => => transferring dockerfile: 879B                                                   0.0s
 => [internal] load .dockerignore                                                      0.0s
 => => transferring context: 2B                                                        0.0s
 => [internal] load metadata for ghcr.io/railwayapp/nixpacks:ubuntu-1693872184         0.9s
 => [internal] load build context                                                      7.8s
 => => transferring context: 988.58MB                                                  7.8s
 => [ 1/10] FROM ghcr.io/railwayapp/nixpacks:ubuntu-1693872184@sha256:c90dd7da0f96190  0.0s
 => CACHED [ 2/10] WORKDIR /app/                                                       0.0s
 => [ 3/10] COPY .nixpacks/nixpkgs-c636fe7908e2b52713ff7c260a9da233effc5b7f.nix .nixp  0.5s
 => [ 4/10] RUN nix-env -if .nixpacks/nixpkgs-c636fe7908e2b52713ff7c260a9da233effc5b  17.7s
 => [ 5/10] COPY . /app/.                                                              3.1s
 => [ 6/10] RUN  bun i --no-save                                                       3.6s
 => [ 7/10] COPY . /app/.                                                              3.7s
 => ERROR [ 8/10] RUN  bun run build                                                   0.1s
------
 > [ 8/10] RUN  bun run build:
0.095 $ node_modules/.bin/next build
0.097 /bin/bash: line 1: node_modules/.bin/next: No such file or directory
0.097 error: script "build" exited with code 127
------
Dockerfile:24
--------------------
  22 |     # build phase
  23 |     COPY . /app/.
  24 | >>> RUN  bun run build
  25 |
  26 |
--------------------
ERROR: failed to solve: process "/bin/bash -ol pipefail -c bun run build" did not complete successfully: exit code: 127
Error: Docker build failed

More context: palladians/minaverse#36

Were you able to solve this issue? I'm getting the same errors