[Haskell-cafe] developing using .devcontainer in vscode

Bryan Richter bryan at haskell.foundation
Mon Jul 31 08:00:07 UTC 2023


Hello,

Based on the README at https://github.com/haskell/docker-haskell, it looks
like this image does not have GHCup installed on it. It probably should. Do
you think you could contribute such a thing?

The repo is also looking for maintainers:
https://github.com/haskell/docker-haskell/issues/72

I myself may take an interest in eventually contributing to the repo in my
HF DevOps role, but I won't have time in the near future.


On Sun, 23 Jul 2023 at 21:33, Han Joosten <han.joosten.han at gmail.com> wrote:

> Hi Cafe,
>
> I am trying to set up a useful development container for an open source
> project I am working on. I have created an image on top of the official
> Haskell image, expecting a proper installation of ghcup, cabal, stack and
> hls. The Dockerfile looks like this:
>
> FROM haskell:8.10
>
> ARG USERNAME=vscode
>
>
> ENV USERNAME=${USERNAME} \
>     USER_UID=1000 \
>     USER_GID=1000 \
>     DEBIAN_FRONTEND=noninteractive \
>     LANG=C.UTF8 \
>     WDIR=/home/${USERNAME}
>
> RUN apt-get update && \
>     apt-get upgrade -y && \
>     apt-get install -y git
>
> RUN groupadd --gid $USER_GID $USERNAME && \
>     useradd -ms /bin/bash -K MAIL_DIR=/dev/null --uid $USER_UID --gid
> $USER_GID -m $USERNAME && \
>     mkdir -p /etc/sudoers.d && \
>     echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME &&
> \
>     chmod 0440 /etc/sudoers.d/$USERNAME
>
> USER ${USER_UID}:${USER_GID}
>
> WORKDIR ${WDIR}
>
> RUN stack update
>
> # Add just the .cabal file to capture dependencies
> COPY ./package.yaml ${WDIR}/package.yaml
> COPY ./stack.yaml ${WDIR}/stack.yaml
>
> # Docker will cache this command as a layer, freeing us up to
> # modify source code without re-installing dependencies
> # (unless one of the copied files changes!)
> RUN stack build --only-dependencies -j4
>
> COPY . ${WDIR}
>
> ENV DEBIAN_FRONTEND=dialog
>
> ENTRYPOINT ["/bin/bash"]
>
>
> The above image is built and pushed to dockerhub. Then, in the vscode
> project, I have a .devcontainer directory with the following Dockerfile:
>
> FROM ampersandtarski/ampersand-devcontainer:latest
>
> ENV DEBIAN_FRONTEND=dialog
>
> ENTRYPOINT ["/bin/bash"]
>
> The idea is that all the building of the dependencies is already done in
> the first image. That takes a lot of time, so this is supposed to be a
> great timesaver (though the image itself is huge).
> However, when I open the project inside the container, I get the following
> error:
> [image: image.png]
>
> If I reload the window, I get the following errors:
> [image: image.png]
>
> Long story short, I am not sure how to use the official Haskell image for
> development in my project. I must be missing something. I have been trying
> lots of things, but without succes. I hope it is possible to have an image
> built on top of the official Haskell file that contains all prebuilt
> dependencies of my project. Are my expectations realistic? If so, what am I
> missing?
> Any help is much appreciated.
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20230731/822443e2/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 7863 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20230731/822443e2/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 13508 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20230731/822443e2/attachment-0001.png>


More information about the Haskell-Cafe mailing list