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.png

If I reload the window, I get the following errors:
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.