1
1
mirror of https://github.com/tweag/asterius.git synced 2024-11-10 14:52:44 +03:00
asterius/base.Dockerfile

136 lines
4.2 KiB
Docker
Raw Normal View History

FROM debian:sid
ARG DEBIAN_FRONTEND=noninteractive
2020-02-17 14:22:18 +03:00
ARG ASTERIUS_AHC_LD_IGNORE=1
ENV \
2020-03-16 15:43:00 +03:00
ASTERIUS_LIB_DIR=/home/asterius/.asterius-local-install-root/share/x86_64-linux-ghc-8.8.3/asterius-0.0.1/.boot/asterius_lib \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
LC_CTYPE=C.UTF-8 \
PATH=/home/asterius/.asterius-local-install-root/bin:/home/asterius/.asterius-snapshot-install-root/bin:/home/asterius/.asterius-compiler-bin:/home/asterius/.local/bin:${PATH}
RUN \
2020-04-07 00:31:20 +03:00
echo 'deb [check-valid-until=no] http://snapshot.debian.org/archive/debian/20200406T084528Z sid main contrib non-free' > /etc/apt/sources.list && \
apt update && \
apt full-upgrade -y && \
apt install -y \
automake \
cmake \
curl \
g++ \
gawk \
gcc \
git \
gnupg \
libffi-dev \
libgmp-dev \
libncurses-dev \
libnuma-dev \
make \
python3 \
sudo \
xz-utils \
zlib1g-dev && \
curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \
echo "deb https://deb.nodesource.com/node_13.x sid main" > /etc/apt/sources.list.d/nodesource.list && \
apt update && \
apt install -y nodejs && \
useradd --create-home --shell /bin/bash asterius && \
echo "asterius ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
USER asterius
WORKDIR /home/asterius
RUN \
mkdir -p ~/.local/bin && \
2020-04-07 00:31:20 +03:00
curl -L https://github.com/commercialhaskell/stack/releases/download/v2.3.0.1/stack-2.3.0.1-linux-x86_64.tar.gz | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack' && \
2020-04-10 21:02:51 +03:00
curl -L https://downloads.haskell.org/~cabal/cabal-install-3.2.0.0/cabal-install-3.2.0.0-x86_64-unknown-linux.tar.xz | tar xJ -C ~/.local/bin 'cabal' && \
2020-03-15 18:45:12 +03:00
npm config set prefix ~/.local && \
mkdir ~/.asterius
COPY --chown=asterius:asterius asterius /home/asterius/.asterius/asterius
COPY --chown=asterius:asterius ghc-toolkit /home/asterius/.asterius/ghc-toolkit
COPY --chown=asterius:asterius npm-utils /home/asterius/.asterius/npm-utils
COPY --chown=asterius:asterius wasm-toolkit /home/asterius/.asterius/wasm-toolkit
COPY --chown=asterius:asterius stack.yaml /home/asterius/.asterius/stack.yaml
RUN \
export CPUS=$(getconf _NPROCESSORS_ONLN 2>/dev/null) && \
export MAKEFLAGS=-j$CPUS && \
cd ~/.asterius && \
stack --no-terminal build \
asterius \
binaryen \
wabt \
alex \
happy \
c2hs \
cpphs && \
ln -s $(stack path --local-install-root) ~/.asterius-local-install-root && \
ln -s $(stack path --snapshot-install-root) ~/.asterius-snapshot-install-root && \
ln -s $(stack path --compiler-bin) ~/.asterius-compiler-bin && \
ahc-boot
RUN \
sudo apt purge -y \
automake \
cmake \
curl \
g++ \
git \
gnupg \
make \
mawk \
python3 \
xz-utils && \
sudo apt autoremove --purge -y && \
sudo apt clean && \
2020-03-26 21:56:38 +03:00
find /home/asterius \( -name "*.p_hi" -o -name "*.p_o" -o -name "*_p.a" \) -type f -delete && \
sudo mv \
/home/asterius/.asterius-local-install-root/bin \
/home/asterius/.asterius-local-install-root/share \
/tmp && \
sudo rm -rf -v \
/home/asterius/.asterius \
/home/asterius/.asterius-compiler-bin/../share \
/home/asterius/.cabal \
/home/asterius/.config \
/home/asterius/.local/bin/stack \
/home/asterius/.npm \
/home/asterius/.stack/programs/*/*.tar.xz \
/var/lib/apt/lists/* \
/var/tmp/* && \
sudo mkdir -p $(realpath -m /home/asterius/.asterius-local-install-root) && \
sudo mv \
/tmp/bin \
/tmp/share \
/home/asterius/.asterius-local-install-root && \
sudo mv \
/home/asterius/.asterius-snapshot-install-root/bin \
/home/asterius/.asterius-snapshot-install-root/share \
/home/asterius/.stack/programs \
/tmp && \
sudo rm -rf -v /home/asterius/.stack && \
sudo mkdir -p $(realpath -m /home/asterius/.asterius-snapshot-install-root) && \
sudo mv \
/tmp/bin \
/tmp/share \
/home/asterius/.asterius-snapshot-install-root && \
sudo mv \
/tmp/programs \
/home/asterius/.stack && \
sudo chown -c -h -R asterius:asterius /home/asterius && \
sudo rm -rf -v \
/tmp/*
RUN \
ahc --version && \
alex --version && \
cabal --version && \
node --version && \
wasm-objdump --version && \
wasm-opt --version