diff options
| author | 2021-12-21 01:54:42 -0800 | |
|---|---|---|
| committer | 2021-12-21 01:54:42 -0800 | |
| commit | df5a3c4da4092d5e59b3d6fbe6165a4daf6e6961 (patch) | |
| tree | 9f1e320f009f486f12a4e89f61fb4aab6f7de5b3 | |
| parent | fe415a30c5004a8045ffd0cf235e0c074b2db9d5 (diff) | |
| download | bun-df5a3c4da4092d5e59b3d6fbe6165a4daf6e6961.tar.gz bun-df5a3c4da4092d5e59b3d6fbe6165a4daf6e6961.tar.zst bun-df5a3c4da4092d5e59b3d6fbe6165a4daf6e6961.zip | |
Add Dockerfile for building Bun
| -rw-r--r-- | Dockerfile | 101 | ||||
| -rw-r--r-- | zig-build/Dockerfile | 62 |
2 files changed, 163 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..c0dfafddb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,101 @@ +# This builds bun in release mode +FROM ubuntu:20.04 +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && apt-get install --no-install-recommends -y wget gnupg2 curl lsb-release wget software-properties-common +RUN curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - + +RUN wget https://apt.llvm.org/llvm.sh --no-check-certificate +RUN chmod +x llvm.sh +RUN ./llvm.sh 12 + +RUN apt-get update && apt-get install --no-install-recommends -y \ + ca-certificates \ + curl \ + gnupg2 \ + software-properties-common \ + cmake \ + build-essential \ + git \ + libssl-dev \ + ruby \ + liblld-12-dev \ + libclang-12-dev \ + nodejs \ + gcc \ + g++ \ + npm \ + clang-12 \ + clang-format-12 \ + libc++-12-dev \ + libc++abi-12-dev \ + lld-12 \ + libicu-dev \ + wget \ + unzip \ + tar + +RUN update-alternatives --install /usr/bin/ld ld /usr/bin/lld-12 90 && \ + update-alternatives --install /usr/bin/cc cc /usr/bin/clang-12 90 && \ + update-alternatives --install /usr/bin/cpp cpp /usr/bin/clang++-12 90 && \ + update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-12 90 + +ENV CC=clang-12 +ENV CXX=clang++-12 + +WORKDIR /home/ubuntu +ARG TARGETPLATFORM +ARG TARGETARCH + +ENV ARCH "$TARGETARCH" + +ENV JSC_BASE_DIR /home/ubuntu/bun-webkit-linux-$ARCH +RUN npm install -g esbuild + +RUN wget https://github.com/Jarred-Sumner/zig/releases/download/dec20/zig-linux-$ARCH.zip; \ + unzip zig-linux-$ARCH.zip; \ + rm zig-linux-$ARCH.zip; +ENV PATH "/home/ubuntu/zig/build:$PATH" + +WORKDIR /home/ubuntu +RUN wget https://github.com/Jarred-Sumner/WebKit/releases/download/Bun-v0/bun-webkit-linux-$ARCH.tar.gz; \ + tar -xzvf bun-webkit-linux-$ARCH.tar.gz; \ + rm bun-webkit-linux-$ARCH.tar.gz + + + +RUN add-apt-repository ppa:longsleep/golang-backports +RUN apt update +RUN apt install golang-go chromium-browser --no-install-recommends ninja-build pkg-config automake autoconf libtool -y --no-install-recommends + +ADD . /home/ubuntu/bun + + +WORKDIR /home/ubuntu +RUN wget https://github.com/unicode-org/icu/releases/download/release-66-1/icu4c-66_1-src.tgz && \ + tar -xzf icu4c-66_1-src.tgz && \ + rm icu4c-66_1-src.tgz && \ + cd icu/source && \ + ./configure --enable-static --disable-shared && \ + make -j$(nproc) && \ + cp lib/libicudata.a /home/ubuntu/bun/src/deps && \ + cp lib/libicui18n.a /home/ubuntu/bun/src/deps && \ + cp lib/libicuio.a /home/ubuntu/bun/src/deps && \ + cp lib/libicutu.a /home/ubuntu/bun/src/deps && \ + cp lib/libicuuc.a /home/ubuntu/bun/src/deps + + + +WORKDIR /home/ubuntu/bun + + + +RUN make api analytics node-fallbacks runtime_js fallback_decoder bun_error mimalloc picohttp zlib libarchive boringssl picohttp + +WORKDIR /home/ubuntu/bun + +RUN make jsc-bindings-headers +RUN make jsc-bindings-mac + +RUN make identifier-cache +RUN make release
\ No newline at end of file diff --git a/zig-build/Dockerfile b/zig-build/Dockerfile new file mode 100644 index 000000000..114c5da4d --- /dev/null +++ b/zig-build/Dockerfile @@ -0,0 +1,62 @@ +# This builds the specifc version of Zig used by Bun +# It outputs a zig.zip file +FROM ubuntu:20.04 + +RUN apt-get update && apt-get install --no-install-recommends -y wget gnupg2 curl lsb-release wget software-properties-common +RUN curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - + +RUN wget https://apt.llvm.org/llvm.sh --no-check-certificate +RUN chmod +x llvm.sh +RUN ./llvm.sh 12 + +RUN apt-get update && apt-get install --no-install-recommends -y \ + ca-certificates \ + curl \ + gnupg2 \ + software-properties-common \ + cmake \ + build-essential \ + git \ + libssl-dev \ + ruby \ + liblld-12-dev \ + libclang-12-dev \ + nodejs \ + gcc \ + g++ \ + npm \ + clang-12 \ + clang-format-12 \ + libc++-12-dev \ + libc++abi-12-dev \ + lld-12 \ + libicu-dev \ + zip + +RUN update-alternatives --install /usr/bin/ld ld /usr/bin/lld-12 90 && \ + update-alternatives --install /usr/bin/cc cc /usr/bin/clang-12 90 && \ + update-alternatives --install /usr/bin/cpp cpp /usr/bin/clang++-12 90 && \ + update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-12 90 + + +ENV CC=clang-12 +ENV CXX=clang++-12 + +# Compile zig +RUN --mount=type=tmpfs,target=/zig-build \ + cd /zig-build && \ + mkdir -p /zig-build; \ + git clone https://github.com/jarred-sumner/zig.git; \ + cd /zig-build/zig; \ + git checkout jarred/zig-sloppy-with-small-structs && \ + cmake . -DCMAKE_BUILD_TYPE=Release && \ + make -j$(nproc) && \ + rm -rf .git; \ + cd /zig-build; \ + zip -r zig.zip zig; \ + mv zig.zip /home/ubuntu/ + + + + + |
