Skip to content

Commit

Permalink
Merge pull request #6266 from benz0li/update-dev-containers-3b9c797
Browse files Browse the repository at this point in the history
Update Dev Containers
  • Loading branch information
mpilgrem authored Oct 2, 2023
2 parents 3b9c797 + 2a47847 commit 838063b
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 29 deletions.
26 changes: 16 additions & 10 deletions .devcontainer/GHC.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ARG STACK_VERSION
ARG HLS_GHC_VERSION=${HLS_VERSION:+$GHC_VERSION}
ARG HLS_SFX=/${HLS_GHC_VERSION:-all}/hls:${HLS_VERSION:-none}

ARG STACK_VERSION_OVERRIDE=${STACK_VERSION:-none}
ARG STACK_VERSION_OVERRIDE=${STACK_VERSION}

FROM ${BUILD_ON_IMAGE}:${GHC_VERSION} as files

Expand All @@ -20,8 +20,6 @@ RUN find /files -type d -exec chmod 755 {} \; \
&& find /files -type f -exec chmod 644 {} \; \
&& find /files/usr/local/bin -type f -exec chmod 755 {} \;

FROM glcr.b-data.ch/commercialhaskell/ssi:${STACK_VERSION_OVERRIDE} as ssi

FROM ${BUILD_ON_IMAGE}${HLS_SFX} as hls

FROM glcr.b-data.ch/ndmitchell/hlsi:latest as hlsi
Expand Down Expand Up @@ -88,8 +86,6 @@ RUN if [ -n "$USE_ZSH_FOR_ROOT" ]; then \
fi

## Copy binaries as late as possible to avoid cache busting
## Install Stack
COPY --from=ssi /usr/local /usr/local
## Install HLS
COPY --from=hls /usr/local /usr/local
## Install HLint
Expand All @@ -100,13 +96,23 @@ COPY --from=sci --chown=root:root /bin/shellcheck /usr/local/bin
ARG HLS_VERSION
ARG STACK_VERSION

ARG STACK_VERSION_OVERRIDE=${STACK_VERSION}
ARG STACK_VERSION_OVERRIDE

ENV HLS_VERSION=${HLS_VERSION} \
STACK_VERSION=${STACK_VERSION_OVERRIDE:-$STACK_VERSION}

RUN if [ "${GHC_VERSION%.*}" = "9.2" ]; then \
if [ -f /usr/local/bin/stack ]; then \
mv -f /usr/local/bin/stack /usr/bin/; \
fi \
RUN if [ -n "$STACK_VERSION_OVERRIDE" ]; then \
## Install Stack
cd /tmp || exit ;\
curl -sSLO https://github.com/commercialhaskell/stack/releases/download/v"$STACK_VERSION"/stack-"$STACK_VERSION"-linux-"$(uname -m)".tar.gz; \
curl -sSLO https://github.com/commercialhaskell/stack/releases/download/v"$STACK_VERSION"/stack-"$STACK_VERSION"-linux-"$(uname -m)".tar.gz.sha256; \
sha256sum -cs stack-"$STACK_VERSION"-linux-"$(uname -m)".tar.gz.sha256; \
tar -xzf stack-"$STACK_VERSION"-linux-"$(uname -m)".tar.gz; \
if dpkg --compare-versions "${GHC_VERSION%.*}" le "9.2"; then \
mv -f stack-"$STACK_VERSION"-linux-"$(uname -m)"/stack /usr/bin/stack; \
else \
mv -f stack-"$STACK_VERSION"-linux-"$(uname -m)"/stack /usr/local/bin/stack; \
fi; \
## Clean up
rm -rf /tmp/*; \
fi
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"dockerfile": "GHC.Dockerfile",
"args": {
"GHC_VERSION": "9.4.7",
"HLS_VERSION": "2.2.0.0",
"HLS_VERSION": "2.3.0.0",
"USE_ZSH_FOR_ROOT": "unset-to-use-ash",
"SET_LANG": "C.UTF-8",
"SET_TZ": ""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "GHC 9.6.2",
"name": "GHC 9.6.3",
"build": {
"dockerfile": "../GHC.Dockerfile",
"context": "..",
"args": {
"GHC_VERSION": "9.6.2",
"GHC_VERSION": "9.6.3",
"USE_ZSH_FOR_ROOT": "unset-to-use-ash",
"SET_LANG": "C.UTF-8",
"SET_TZ": ""
Expand Down Expand Up @@ -46,14 +46,14 @@
// Set 'remoteUser' to 'root' to connect as root instead.
"remoteUser": "vscode",
"mounts": [
"source=stack-ghc-9.6.2-home-vscode,target=/home/vscode,type=volume"
// "source=${localWorkspaceFolder}/.devcontainer/bind-mounts/stack-ghc-9.6.2-home-vscode,target=/home/vscode,type=bind"
"source=stack-ghc-9.6.3-home-vscode,target=/home/vscode,type=volume"
// "source=${localWorkspaceFolder}/.devcontainer/bind-mounts/stack-ghc-9.6.3-home-vscode,target=/home/vscode,type=bind"
],

// "remoteUser": "root",
// "mounts": [
// "source=stack-ghc-9.6.2-root,target=/root,type=volume"
// // "source=${localWorkspaceFolder}/.devcontainer/bind-mounts/stack-ghc-9.6.2-root,target=/root,type=bind"
// "source=stack-ghc-9.6.3-root,target=/root,type=volume"
// // "source=${localWorkspaceFolder}/.devcontainer/bind-mounts/stack-ghc-9.6.3-root,target=/root,type=bind"
// ],

// Pip: Install packages to the user site
Expand Down
22 changes: 11 additions & 11 deletions doc/dev_containers.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,24 @@ extensions pre‑installed:

## Parent images

Stack's Dev Containers are derived from Docker images that are used to build the
*statically linked* Linux/x86_64 and Linux/AArch64 binary distributions of
Stack's Dev Containers are derived from Docker images that are used to build
the *statically linked* Linux/x86_64 and Linux/AArch64 binary distributions of
Stack.

These Docker images are multi-architecture (`linux/amd64`, `linux/arm64/v8`)
*ghc‑musl* images. They are based on Alpine Linux (that is
These Docker images are multiarchitecture (`linux/amd64`, `linux/arm64/v8`)
<nobr>*GHC musl*</nobr> images. They are based on Alpine Linux (that is
[musl libc](https://musl.libc.org) and [BusyBox](https://www.busybox.net)).

The images contain *unofficial* binary distributions of GHC 9.4.7 and 9.6.2
(that is, ones not released by the GHC developers). That is because:
The images contain *unofficial* binary distributions of GHC (that is, ones not
released by the GHC developers). That is because:

1. the official GHC 9.6.2 binary distributions for Alpine Linux/x86_64 have
known bugs; and
1. the official GHC binary distributions for Alpine Linux/x86_64 have known
bugs; and
2. there are no official binary distributions for Alpine Linux/AArch64.

Stack's global configuration (`/etc/stack/config.yaml`) sets `system-ghc: true`
and `install-ghc: false`. That ensures that only the GHC available in the Dev
Containers is used.
Stack's global configuration (`/etc/stack/config.yaml`) sets
<nobr>`system-ghc: true`</nobr> and <nobr>`install-ghc: false`</nobr>. That
ensures that only the GHC available in the Dev Containers is used.

## Usage

Expand Down
2 changes: 1 addition & 1 deletion stack-ghc-9.6.3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ resolver: nightly-2023-10-01

docker:
enable: false
repo: glcr.b-data.ch/ghc/ghc-musl:9.6.2 # Still GHC 9.6.2. See https://github.com/benz0li/ghc-musl/issues/5
repo: glcr.b-data.ch/ghc/ghc-musl:9.6.3

nix:
# --nix on the command-line to enable.
Expand Down

0 comments on commit 838063b

Please sign in to comment.