1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-18 04:11:47 +03:00
juvix/.devcontainer/Dockerfile
Paul Cadman 46ab163ca7
Update stackage resolver to LTS 21.6 (#2275)
Stack LTS 21.6 uses GHC 9.4.5, binaries for HLS are available via ghcup.

Changes required:

1. Fix warnings about type level `:` and `[]` used without backticks.
2. Fix warnings about deprecation of builtin `~` - replaced with `import
Data.Type.Equality ( type (~) )` in the Prelude
3. SemVer is no longer a monoid
4. `path-io` now contains the `AnyPath` instances we were defining
(thanks to Jan) so they can be removed.
5. Added `aeson-better-errors-0.9.1.1` as an extra-dep. The reason it is
not part of the resolver is only because it has a strict bound on base
which is not compatible with ghc 9.4.5. To work around this I've set:

    ```
    allow-newer: true
    allow-newer-deps:
      - aeson-better-errors
    ```
which relaxed the upper constraint bounds for `aeson-better-errors`
only. When the base constraints have been updated we can remove this
workaround.

6. Use stack2cabal to generate the cabal.project file and to freeze
dependency versions.

    https://www.stackage.org/lts-21.6/cabal.config now contains the
constraint `haskeline installed`, which means that the version of
haskeline that is globally installed with GHC 9.4.5 will be used, see:
    * https://github.com/commercialhaskell/stackage/issues/7002
GHC 9.4.5 comes with haskeline 0.8.2 preinstalled but our configuration
contains the source-repository-package for haskeline 0.8.2.1 (required
because we're using a fork) so if you try to run` cabal build` you get a
conflict.

Constraints from cabal imports cannot yet be overridden so it's not
possible to get rid of this conflict using the import method. So we need
to use stack2cabal with an explicit freeze file instead.

7. Remove `runTempFilePure` as this is unused and depends on
`Polysemy.Fresh` in `polysemy-zoo` which is not available in the
resolver. It turns out that it's not possible to use the `Fresh` effect
in a pure context anyway, so it was not possible to use
`runTempFilePure` for its original purpose.

8. We now use https://github.com/benz0li/ghc-musl as the base container
for static linux builds, this means we don't need to maintain our own
Docker container for this purpose.

9. The PR for the nightly builds is ready
https://github.com/anoma/juvix-nightly-builds/pull/2, it should be
merged as soon as this PR is merged.

Thanks to @benz0li for maintaining https://github.com/benz0li/ghc-musl
and (along with @TravisCardwell) for help with building the static
binary.

* Closes https://github.com/anoma/juvix/issues/2166
2023-08-11 11:49:33 +02:00

86 lines
2.6 KiB
Docker

# OS
ARG VARIANT="ubuntu-22.04"
FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT}
ENV DEBIAN_FRONTEND=noninteractive
ENV BOOTSTRAP_HASKELL_NONINTERACTIVE=1
ENV BOOTSTRAP_HASKELL_GHC_VERSION=9.4.5
ENV BOOTSTRAP_HASKELL_CABAL_VERSION=3.10.1.0
ENV BOOTSTRAP_HASKELL_STACK_VERSION=2.11.1
ENV BOOTSTRAP_HASKELL_INSTALL_STACK=1
ENV BOOTSTRAP_HASKELL_INSTALL_HLS=1
# OS packages for ghcup and juvix runtime
RUN apt-get update && \
apt-get -y install --no-install-recommends \
curl \
sudo \
wget \
unzip \
git \
jq \
bc \
make \
cmake \
clang \
lldb \
lld \
llvm \
automake \
rsync \
htop \
build-essential \
lsb-release \
pkg-config \
libffi-dev \
libgmp-dev \
libgmp10 \
software-properties-common \
libssl-dev \
libicu-dev \
libtinfo-dev \
libsystemd-dev \
zlib1g-dev \
g++ \
libncurses-dev \
libncursesw5 \
libtinfo5 \
libtool \
autoconf && apt-get clean
RUN sudo bash -c 'curl -sSL https://get.haskellstack.org/ | sh'
ENV PATH=${PATH}:/home/vscode/.ghcup/bin
RUN sudo bash -c "curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh"
ENV PATH=${PATH}:/home/vscode/.local/bin
RUN sudo bash -c 'mkdir -p /home/vscode/.local/bin'
RUN sudo bash -c "chown -R vscode /home/vscode/.local/"
RUN sudo bash -c 'curl https://get.wasmer.io -sSfL | sudo WASMER_DIR=/home/vscode/.local sh'
# to be used by the juvix extension
RUN sudo bash -c 'mkdir -p /home/vscode/.local/juvix'
RUN sudo bash -c 'chmod -R a+rXw /home/vscode/.local/juvix'
RUN sudo bash -c 'curl --proto "=https" --tlsv1.2 -sSfL https://get.juvix.org \
| sudo XDG_BIN_HOME=/home/vscode/.local/bin JUVIX_INSTALLER_INSTALL_VAMPIR_YES=true JUVIX_INSTALLER_ASSUME_YES=true sh'
RUN sudo bash -c 'mkdir -p /home/vscode/.local/wasi-sysroot'
RUN sudo bash -c 'curl -s https://api.github.com/repos/WebAssembly/wasi-sdk/releases/tags/wasi-sdk-16 \
| grep -a "browser_download_url.*wasi-sysroot-16.*tar.gz" \
| cut -d : -f 2,3 \
| tr -d \" \
| wget --output-document wasi-sysroot.tar.gz -qi - \
&& tar xvf wasi-sysroot.tar.gz --directory /home/vscode/.local/wasi-sysroot/'
ENV WASI_SYSROOT_PATH=/home/vscode/.local/wasi-sysroot/
RUN sudo bash -c 'curl -s https://api.github.com/repos/jonaprieto/smoke/releases/latest \
| grep -a "browser_download_url.*Linux" \
| cut -d : -f 2,3 \
| tr -d \" \
| wget --output-document smoke -qi - \
&& mv smoke /home/vscode/.local/bin/smoke \
&& chmod a+x /home/vscode/.local/bin/smoke'