-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
63 lines (57 loc) · 1.48 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
ARG BASE=ubuntu:24.04
FROM $BASE
ENV DEBIAN_FRONTEND=noninteractive TZ=UTC
ARG EMSCRIPTEN_VERSION=3.1.47
# Install prerequisites for building LLVM, R, and webR wasm system libraries
RUN apt-get update && apt-get -y install --no-install-recommends \
build-essential \
ca-certificates \
clang \
cmake \
curl \
gfortran \
gh \
git \
gnupg \
gperf \
jq \
libbz2-dev \
libcurl4-openssl-dev \
libglib2.0-dev-bin \
liblzma-dev \
libpcre2-dev \
libssl-dev \
libxml2-dev \
libz-dev \
lld \
ninja-build \
pkg-config \
python3 \
python3-setuptools \
quilt \
sqlite3 \
sudo \
tzdata \
unzip \
wget
# Install emsdk
RUN git clone --depth=1 https://github.com/emscripten-core/emsdk.git /opt/emsdk
WORKDIR /opt/emsdk
RUN ./emsdk install "${EMSCRIPTEN_VERSION}" && \
./emsdk activate "${EMSCRIPTEN_VERSION}"
# Build LLVM flang
COPY Makefile /root/flang-wasm/Makefile
RUN . /opt/emsdk/emsdk_env.sh && \
cd /root/flang-wasm && \
make PREFIX="/opt/flang" FLANG_WASM_CMAKE_VARS="-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ -DLLVM_USE_LINKER=lld" && \
make PREFIX="/opt/flang" install
# Clean up
RUN . /opt/emsdk/emsdk_env.sh && emcc --clear-cache
RUN rm -rf /root/flang-wasm /opt/emsdk/downloads/*
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Squash docker image layers
FROM $BASE
ENV DEBIAN_FRONTEND=noninteractive TZ=UTC
COPY --from=0 / /
SHELL ["/bin/bash", "-c"]