Dev Containers added to Stack repository

@benz0li has added Development (Dev) Containers to the Stack GitHub repository. For more information, see Dev Containers - The Haskell Tool Stack.

5 Likes

The GHC musl repository provides general purpose Dev Containers:

:information_source: For further information, see GHC musl: Dev Containers.

1 Like

Not to derail the discussion, but are dev containers trying to accomplish the same thing as Nix shells ? I’ve never used them, it’d be great to hear from someone familiar with both.

1 Like

They are highly similar. But devcontainers are rally just docker images. And as such linux. Whereas nix shells can be darwin as well. And conceptually bsd too.

We do have GitHub - input-output-hk/devx: Slightly opinionated shared GitHub Action for Cardano-Haskell projects which provides nix shells; we also just wrap those into docker containers for use as devcontainers; including the cross (static, JavaScript, windows) ones.

It’s really just packaging. Whether or not the underlying shell is nix provisioned or though some other mechanism (e.g. installing software through the chosen Linux’s package manager—that’s essentially what nix is on nixOS (a Linux distribution)) is fairly invisible from the users perspective.

2 Likes

@angerman Yes: Nix will be (is?) THE tool for DevOps. I will also use it in the future. Better sooner than later… steep learning curve, though.

I do not plan on going much further with containers (than e.g. GHC musl and these Dev Containers).

2 Likes

How did it come to these Dev Containers?

Framework:

  1. I have no affiliation with the Haskell Foundation Working Group or the Commercial Haskell SIG.
  2. I am not using Haskell myself and have never written an single line of Haskell code on my own.

Long story short:

  1. I am a Data Scientist
    • using containers for reproducible research.
  2. Running stuff on Apple hardware
    • both Intel (x86_64) and Apple Silicon (AArch64).
  3. There was no Pancoc for Linux/AArch64
    • which is used for scientific and technical publishing with R.
  4. Saw issue Can Binary Releases be Done for aarch64 and armv7h · Issue #5450 · jgm/pandoc · GitHub.
  5. Went down the rabbit hole, got lost, and vanished for some time.
  6. Started GHC musl.
  7. Resolved Pandoc Issue #5450.
  8. Worked on Data Science Dev Containers.

One thing led to another… and… here we are.

Out of curiosity – and thanks to the help of the Haskell community.

4 Likes

The main advantage of GHC musl (and its Dev Containers) is that they are based on Alpine Linux (that is musl libc and BusyBox).

Alpine Linux – or more accurately musl libc – is made for static linking; i.e. building executables that can run on any Linux machine of the same architecture.

That is why GHC musl is used to build the statically linked Linux amd64 and arm64 binary releases of Pandoc and Stack.

1 Like

Wow this is really nice. Thank you @benz0li for your work! Alpine + static linking = tiny docker images for fast CI/CD !

2 Likes

The GHC musl images are now mirrored to both Docker Hub and Quay:

This ensures the long-term availability.

5 Likes