Repository navigation
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
What version of Bun is running?
1.0.0
What platform is your computer?
Linux 5.10.47-linuxkit x86_64 x86_64
What steps can reproduce the bug?
Dockerfile
FROM --platform=linux/amd64 docker.io/ubuntu:latest
RUN apt-get update && apt-get install -y curl unzip
RUN curl -fsSL https://bun.sh/install | bash
COPY . .
ENV PATH=$PATH:/root/.bun/bin
RUN bun --version
RUN bun run buildpackage.json
{
"private": true,
"scripts": {
"build": "bun index.mjs"
}
}index.mjs
import { join } from 'path'
const abs = join(process.cwd(), './index.mjs')
console.log('reading file', abs)
const file = Bun.file(abs)
const content = await file.text()
console.log(content)What is the expected behavior?
Should print file contents when building the dockerfile with:
docker build -t test-bun .
What do you see instead?
[+] Building 2.5s (10/10) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 74B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/ubuntu:latest 0.5s
=> [1/6] FROM docker.io/library/ubuntu:latest@sha256:aabed3296a3d45cede1dc866a24476c4d7e093aa806263c27ddaadbdce3c1054 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 203B 0.0s
=> CACHED [2/6] RUN apt-get update && apt-get install -y curl unzip 0.0s
=> CACHED [3/6] RUN curl -fsSL https://bun.sh/install | bash 0.0s
=> [4/6] COPY . . 0.0s
=> [5/6] RUN bun --version 0.2s
=> ERROR [6/6] RUN bun run build 1.7s
------
> [6/6] RUN bun run build:
#10 0.206 $ bun index.mjs
#10 1.566 reading file /index.mjs
#10 1.644 error: script "build" exited with code 1 (SIGHUP)
------
executor failed running [/bin/sh -c bun run build]: exit code: 1
Additional information
I can reproduce the issue on ubuntu and centos.
When I run locally with macOS, it works correctly.
Reacted by Steven and Ricki
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Activity
[-]bun run build fails in docker ubuntu[/-][+]`bun run build` fails in docker ubuntu: script "build" exited with code 1 (SIGHUP)[/+][-]`bun run build` fails in docker ubuntu: script "build" exited with code 1 (SIGHUP)[/-][+]`bun run` fails in docker ubuntu: script "build" exited with code 1 (SIGHUP)[/+]japhex commentedon Sep 12, 2023
There is an official
oven/bunimage - should you not be using that instead?just
FROM oven/bunstyfle commentedon Sep 12, 2023
@japhex It also fails with
oven/bun. Try this:The issue is likely related to the kernel version or
io_uringof the host machine.Oddly enough,
bun index.mjsworks butbun run buildfails (even though these should be the exact same code).youfun commentedon Sep 14, 2023
i have the same problem with the office bun . sometimes it work,but most of time it fails.
Dockerfile:7
5 | RUN bun install
6 | COPY . .
7 | >>> RUN bun run build
8 | EXPOSE 3000
9 | ENTRYPOINT ["bun", "./build"]
error: failed to solve: process "/bin/sh -c bun run build" did not complete successfully: exit code: 1
youfun commentedon Sep 14, 2023
i try “FROM --platform=linux/amd64” and “ven/bun”, all failed. i check the cpu ,it is amd