vscode-haskell
vscode-haskell copied to clipboard
Setup devcontainer keeps asking for ghcup
I am trying to setup a devcontainer, so other contributors of our team do not have to worry about their tooling. However, it keeps complaining about ghcup not installed.
The Dockerfile builds fine, but as soon as the HLS extention is activated, it complains that ghcup isn't installed. ghc and stack are available however.
Any ideas about how to fix this? It might help others too. Thanks in advance!
FROM haskell:8.10.7
# This Dockerfile adds a non-root user with sudo access. Use the "remoteUser"
# property in devcontainer.json to use it. On Linux, the container user's GID/UIDs
# will be updated to match your local UID/GID (when using the dockerFile property).
# See https://aka.ms/vscode-remote/containers/non-root-user for details.
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID
# Create the user
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
#
# [Optional] Add sudo support. Omit if you don't need to install software after connecting.
&& apt-get update \
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME
# ********************************************************
# * Anything else you want to do like clean up goes here *
# ********************************************************
# Set to false to skip installing zsh and Oh My ZSH!
ARG INSTALL_ZSH="false"
# Location and expected SHA for common setup script - SHA generated on release
ARG COMMON_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/master/script-library/common-alpine.sh"
ARG COMMON_SCRIPT_SHA="dev-mode"
# Configure apt and install packages
# RUN apk update \
# && apk add --no-cache wget coreutils ca-certificates \
# && wget -q -O /tmp/common-setup.sh $COMMON_SCRIPT_SOURCE \
# && if [ "$COMMON_SCRIPT_SHA" != "dev-mode" ]; then echo "$COMMON_SCRIPT_SHA /tmp/common-setup.sh" | sha256sum -c - ; fi \
# && /bin/ash /tmp/common-setup.sh "$INSTALL_ZSH" "$USERNAME" "$USER_UID" "$USER_GID" \
# && rm /tmp/common-setup.sh
RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
RUN which ghc
RUN ghc --version
RUN stack install ormolu-0.1.4.1 --resolver=lts-18.18
USER $USERNAME
ghcup by default gets installed into ~/.ghcup/bin
. The main ghc
in your PATH is not from ghcup.
So in fact, I'd suggest to not use haskell:8.10.7
, since it would mean you install 8.10.7 twice. The image has little use.
Instead, you could write a Dockerfile from scratch. All you need is:
- Install the dependencies, list is here https://github.com/haskell/ghcup-metadata/blob/master/ghcup-0.0.7.yaml#L59
- install ghcup
- Make sure
~/.ghcup/bin
is in PATH in the docker image
Also make sure to have read https://github.com/haskell/vscode-haskell#ghc-abis-dont-match in case you're using stack.
Also see https://gitlab.haskell.org/haskell/ghcup-hs/-/merge_requests/173
Also note that your ghcup install line should be
RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 sh
Also see https://www.haskell.org/ghcup/guide/#continuous-integration
Closed due to inactivity