1
1
mirror of https://github.com/tweag/asterius.git synced 2024-09-11 08:55:32 +03:00

Add vscode remote containers support (#487)

This commit is contained in:
Shao Cheng 2020-03-13 16:16:50 +01:00 committed by GitHub
parent 181da7dcfd
commit 0c1aa2d2ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 95 additions and 1 deletions

54
.devcontainer/Dockerfile Normal file
View File

@ -0,0 +1,54 @@
FROM debian:sid
ARG DEBIAN_FRONTEND=noninteractive
ENV \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
LC_CTYPE=C.UTF-8 \
PATH=/home/asterius/.local/bin:${PATH}
RUN \
echo 'deb [check-valid-until=no] http://snapshot.debian.org/archive/debian/20200224T000000Z sid main' > /etc/apt/sources.list && \
apt update && \
apt full-upgrade -y && \
apt install -y \
automake \
cmake \
curl \
direnv \
g++ \
gawk \
gcc \
git \
gnupg \
libffi-dev \
libgmp-dev \
libncurses-dev \
libnuma-dev \
make \
python3-pip \
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 \
echo "eval \"\$(direnv hook bash)\"" >> ~/.bashrc && \
mkdir -p ~/.local/bin && \
curl -L https://github.com/commercialhaskell/stack/releases/download/v2.1.3/stack-2.1.3-linux-x86_64.tar.gz | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack' && \
curl -L https://downloads.haskell.org/~cabal/cabal-install-3.0.0.0/cabal-install-3.0.0.0-x86_64-unknown-linux.tar.xz | tar xJ -C ~/.local/bin 'cabal' && \
stack update && \
cabal v1-update && \
pip3 install \
recommonmark \
sphinx

22
.devcontainer/build.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/sh -e
export CPUS=$(getconf _NPROCESSORS_ONLN 2>/dev/null)
export ASTERIUS_BUILD_OPTIONS=-j$CPUS
export MAKEFLAGS=-j$CPUS
stack install -j$CPUS \
brittany \
ghcid \
hlint \
ormolu \
wai-app-static
stack build -j$CPUS --test --no-run-tests \
asterius \
ghc-toolkit \
wabt \
wasm-toolkit
stack exec ahc-boot
direnv allow .envrc

View File

@ -0,0 +1,18 @@
{
"name": "asterius",
"dockerFile": "Dockerfile",
"appPort": [3000],
"remoteUser": "asterius",
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"postCreateCommand": ".devcontainer/build.sh",
"extensions": [
"justusadam.language-haskell",
"hoovercj.haskell-linter",
"maxgabriel.brittany",
"sjurmillidahl.ormolu-vscode",
"esbenp.prettier-vscode",
"stkb.rewrap"
]
}

2
.envrc
View File

@ -1 +1 @@
export PATH=$(stack path --bin-path)
export PATH=$(stack exec printenv PATH)