Skip to content

Commit fe56df7

Browse files
committed
Fix building the container (?)
1 parent 81a6ba0 commit fe56df7

File tree

4 files changed

+80
-118
lines changed

4 files changed

+80
-118
lines changed

.devcontainer/Dockerfile

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1-
FROM debian as base
2-
3-
ARG USERNAME=vscode
4-
ARG GHC_VERSION=9.0.2
5-
ARG STACK_VERSION=2.7.5
6-
ARG STACK_RESOLVER=lts-19.16
7-
ARG CABAL_VERSION=3.4.1.0
8-
ARG HLS_VERSION=1.7.0.0
9-
ARG LLVM_VERSION=12
10-
11-
ENV USERNAME=${USERNAME} \
12-
USER_UID=2001 \
13-
USER_GID=2001 \
1+
FROM debian:bullseye-slim as base
2+
3+
ENV LANG C.UTF-8
4+
5+
ARG GHC_VERSION=9.4.4
6+
ARG STACK_VERSION=recommended
7+
ARG STACK_RESOLVER=default
8+
ARG CABAL_VERSION=recommended
9+
ARG HLS_VERSION=recommended
10+
ARG LLVM_VERSION=14
11+
12+
ENV USERNAME=vscode \
13+
USER_UID=1000 \
14+
USER_GID=1000 \
1415
DEBIAN_FRONTEND=noninteractive \
1516
GHC_VERSION=${GHC_VERSION} \
16-
STACK_RESOLVER=${STACK_RESOLVER} \
1717
STACK_VERSION=${STACK_VERSION} \
18+
STACK_RESOLVER=${STACK_RESOLVER} \
1819
CABAL_VERSION=${CABAL_VERSION} \
1920
HLS_VERSION=${HLS_VERSION} \
2021
LLVM_VERSION=${LLVM_VERSION}
@@ -26,16 +27,16 @@ RUN apt-get install -y --no-install-recommends apt-utils bash build-essential ca
2627

2728
RUN wget -O /tmp/llvm.sh https://apt.llvm.org/llvm.sh && chmod +x /tmp/llvm.sh && /tmp/llvm.sh ${LLVM_VERSION} && rm /tmp/llvm.sh
2829

29-
RUN groupadd --gid $USER_GID $USERNAME && \
30-
useradd -ms /bin/bash -K MAIL_DIR=/dev/null --uid $USER_UID --gid $USER_GID -m $USERNAME && \
31-
echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME && \
32-
chmod 0440 /etc/sudoers.d/$USERNAME
30+
RUN groupadd --gid ${USER_GID} ${USERNAME} && \
31+
useradd -ms /bin/bash -K MAIL_DIR=/dev/null --uid ${USER_UID} --gid ${USER_GID} -m ${USERNAME} && \
32+
echo ${USERNAME} ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USERNAME} && \
33+
chmod 0440 /etc/sudoers.d/${USERNAME}
3334

3435
USER ${USER_UID}:${USER_GID}
3536
WORKDIR /home/${USERNAME}
3637
ENV PATH="/home/${USERNAME}/.local/bin:/home/${USERNAME}/.cabal/bin:/home/${USERNAME}/.ghcup/bin:$PATH"
3738

38-
RUN echo "export PATH=$PATH" >> /home/$USERNAME/.profile
39+
RUN echo "export PATH=${PATH}" >> /home/${USERNAME}/.profile
3940

4041
ENV BOOTSTRAP_HASKELL_NONINTERACTIVE=yes \
4142
BOOTSTRAP_HASKELL_NO_UPGRADE=yes
@@ -45,10 +46,10 @@ FROM base as tooling
4546
RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
4647

4748
# Set the GHC version.
48-
RUN ghcup install ghc ${GHC_VERSION} && ghcup set ghc ${GHC_VERSION}
49+
RUN ghcup install ghc ${GHC_VERSION} --set
4950

5051
# Install cabal-iinstall
51-
RUN ghcup install cabal ${CABAL_VERSION} && ghcup set cabal ${CABAL_VERSION}
52+
RUN ghcup install cabal ${CABAL_VERSION} --set
5253

5354
# Update Cabal.
5455
RUN cabal update && cabal new-install cabal-install
@@ -58,40 +59,41 @@ RUN cabal user-config update -f && \
5859
sed -i 's/-- ghc-options:/ghc-options: -haddock/g' ~/.cabal/config
5960

6061
# Install stack
61-
RUN ghcup install stack ${STACK_VERSION} && ghcup set stack ${STACK_VERSION}
62+
RUN ghcup install stack ${STACK_VERSION} --set
6263

6364
# Set system-ghc, install-ghc and resolver for stack.
6465
RUN ((stack ghc -- --version 2>/dev/null) || true) && \
6566
# Set global defaults for stack.
6667
stack config --system-ghc set system-ghc true --global && \
6768
stack config --system-ghc set install-ghc false --global && \
68-
stack config --system-ghc set resolver $STACK_RESOLVER
69+
test "${STACK_RESOLVER}" = 'default' && export STACK_RESOLVER=$(stack ls snapshots remote | grep -B1 "\(ghc-${GHC_VERSION}\)" | head -2 | sed -n -e 's/^Resolver name: \(\S\+\)$/\1/p'); \
70+
stack config --system-ghc set resolver ${STACK_RESOLVER}
6971

7072
# Set global custom defaults for stack.
7173
RUN printf "ghc-options:\n \"\$everything\": -haddock\n" >> /home/${USERNAME}/.stack/config.yaml
7274

7375
# Install hls
74-
RUN ghcup install hls ${HLS_VERSION} && ghcup set hls ${HLS_VERSION}
76+
RUN ghcup install hls ${HLS_VERSION} --set
7577

7678
FROM tooling as packages
7779

7880
# Install global packages.
7981
# Versions are pinned, since we don't want to accidentally break anything (by always installing latest).
8082
RUN cabal install --haddock-hoogle \
81-
fsnotify-0.3.0.1 \
82-
haskell-dap-0.0.15.0 \
83-
ghci-dap-0.0.17.0 \
84-
haskell-debug-adapter-0.0.35.0 \
85-
hlint-3.3.6 \
86-
apply-refact-0.9.3.0 \
87-
retrie-1.1.0.0 \
83+
# fsnotify-0.3.0.1 \
84+
haskell-dap-0.0.16.0 \
85+
ghci-dap-0.0.20.0 \
86+
haskell-debug-adapter-0.0.39.0 \
87+
hlint-3.5 \
88+
apply-refact-0.11.0.0 \
89+
retrie-1.2.1.1 \
8890
hoogle-5.0.18.3 \
89-
ormolu-0.3.1.0
91+
ormolu-0.5.2.0
9092

91-
FROM packages as hoogle
93+
#FROM packages as hoogle
9294

9395
# Generate hoogle db
94-
RUN hoogle generate && stack hoogle
96+
#RUN hoogle generate && stack hoogle
9597

9698
ENV DEBIAN_FRONTEND=dialog
9799

.devcontainer/devcontainer.json

Lines changed: 38 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -5,87 +5,47 @@
55
"build": {
66
"args": {
77
"USERNAME": "vscode",
8-
"GHC_VERSION": "9.0.2",
9-
"STACK_VERSION": "2.7.5",
10-
"STACK_RESOLVER": "lts-19.16",
11-
"CABAL_VERSION": "3.6.2.0",
12-
"HLS_VERSION": "1.7.0.0",
13-
"LLVM_VERSION": "12"
8+
"GHC_VERSION": "9.4.4",
9+
"STACK_VERSION": "recommended",
10+
"STACK_RESOLVER": "default",
11+
"CABAL_VERSION": "recommended",
12+
"HLS_VERSION": "recommended",
13+
"LLVM_VERSION": "14"
1414
},
1515
"context": "..",
1616
"dockerfile": "Dockerfile"
1717
},
18-
"extensions": [
19-
"haskell.haskell",
20-
"phoityne.phoityne-vscode",
21-
"eriksik2.vscode-ghci",
22-
"jcanero.hoogle-vscode"
23-
],
24-
"settings": {
25-
"files.exclude": {
26-
"**/*.olean": true,
27-
"**/.DS_Store": true,
28-
"**/.git": true,
29-
"**/.hg": true,
30-
"**/.svn": true,
31-
"**/CVS": true
32-
},
33-
"haskell.checkProject": true,
34-
"haskell.formattingProvider": "ormolu",
35-
"haskell.indentationRules.enabled": true,
36-
"haskell.liquidOn": false,
37-
"haskell.manageHLS": "GHCup",
38-
"haskell.maxCompletions": 40,
39-
"haskell.openDocumentationInHackage": false,
40-
"haskell.openSourceInHackage": false,
41-
"haskell.plugin.alternateNumberFormat.globalOn": true,
42-
"haskell.plugin.callHierarchy.globalOn": true,
43-
"haskell.plugin.changeTypeSignature.globalOn": true,
44-
"haskell.plugin.class.globalOn": true,
45-
"haskell.plugin.eval.config.diff": true,
46-
"haskell.plugin.eval.config.exception": true,
47-
"haskell.plugin.eval.globalOn": true,
48-
"haskell.plugin.ghcide-code-actions-bindings.globalOn": true,
49-
"haskell.plugin.ghcide-code-actions-fill-holes.globalOn": true,
50-
"haskell.plugin.ghcide-code-actions-imports-exports.globalOn": true,
51-
"haskell.plugin.ghcide-code-actions-type-signatures.globalOn": true,
52-
"haskell.plugin.ghcide-completions.config.autoExtendOn": true,
53-
"haskell.plugin.ghcide-completions.config.snippetsOn": true,
54-
"haskell.plugin.ghcide-completions.globalOn": true,
55-
"haskell.plugin.ghcide-hover-and-symbols.hoverOn": true,
56-
"haskell.plugin.ghcide-hover-and-symbols.symbolsOn": true,
57-
"haskell.plugin.ghcide-type-lenses.config.mode": "always",
58-
"haskell.plugin.ghcide-type-lenses.globalOn": true,
59-
"haskell.plugin.haddockComments.globalOn": true,
60-
"haskell.plugin.hlint.codeActionsOn": true,
61-
"haskell.plugin.hlint.config.flags": [],
62-
"haskell.plugin.hlint.diagnosticsOn": true,
63-
"haskell.plugin.importLens.codeActionsOn": true,
64-
"haskell.plugin.importLens.codeLensOn": true,
65-
"haskell.plugin.moduleName.globalOn": true,
66-
"haskell.plugin.pragmas.codeActionsOn": true,
67-
"haskell.plugin.pragmas.completionOn": true,
68-
"haskell.plugin.qualifyImportedNames.globalOn": true,
69-
"haskell.plugin.refineImports.codeActionsOn": true,
70-
"haskell.plugin.refineImports.codeLensOn": true,
71-
"haskell.plugin.refineImports.globalOn": true,
72-
"haskell.plugin.rename.config.crossModule": true,
73-
"haskell.plugin.rename.globalOn": true,
74-
"haskell.plugin.retrie.globalOn": true,
75-
"haskell.plugin.splice.globalOn": true,
76-
"haskell.plugin.tactic.config.max_use_ctor_actions": 5,
77-
"haskell.plugin.tactics.codeActionsOn": true,
78-
"haskell.plugin.tactics.codeLensOn": true,
79-
"haskell.plugin.tactics.config.auto_gas": 4,
80-
"haskell.plugin.tactics.config.hole_severity": "hint",
81-
"haskell.plugin.tactics.config.max_use_ctor_actions": 5,
82-
"haskell.plugin.tactics.config.proofstate_styling": true,
83-
"haskell.plugin.tactics.config.timeout_duration": 5,
84-
"haskell.plugin.tactics.globalOn": true,
85-
"haskell.plugin.tactics.hoverOn": true,
86-
"haskell.trace.client": "error",
87-
"haskell.trace.server": "off",
88-
"haskell.upgradeGHCup": true,
89-
"hoogle-vscode.useCabalDependencies": true
18+
"customizations": {
19+
"vscode": {
20+
"extensions": [
21+
"haskell.haskell",
22+
"phoityne.phoityne-vscode",
23+
"eriksik2.vscode-ghci",
24+
"jcanero.hoogle-vscode"
25+
],
26+
"settings": {
27+
"files.exclude": {
28+
"**/*.olean": true,
29+
"**/.DS_Store": true,
30+
"**/.git": true,
31+
"**/.hg": true,
32+
"**/.svn": true,
33+
"**/CVS": true
34+
},
35+
"haskell.checkProject": true,
36+
"haskell.formattingProvider": "ormolu",
37+
"haskell.indentationRules.enabled": true,
38+
"haskell.liquidOn": false,
39+
"haskell.checkParents": "CheckOnSave",
40+
"haskell.manageHLS": "GHCup",
41+
"haskell.maxCompletions": 40,
42+
"haskell.openDocumentationInHackage": false,
43+
"haskell.openSourceInHackage": false,
44+
"haskell.trace.client": "error",
45+
"haskell.trace.server": "off",
46+
"haskell.upgradeGHCup": true,
47+
"hoogle-vscode.useCabalDependencies": true
48+
}
49+
}
9050
}
9151
}

.github/workflows/docker-image.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ jobs:
1717
fail-fast: true
1818
max-parallel: 2
1919
matrix:
20-
ghc: ["9.0.2"]
21-
stack: ["2.7.5"]
22-
resolver: ["lts-19.16"]
23-
cabal: ["3.6.2.0"]
24-
hls: ["1.7.0.0"]
20+
ghc: ["9.4.4"]
21+
stack: ["recommended"]
22+
resolver: ["default"]
23+
cabal: ["recommended"]
24+
hls: ["recommended"]
2525
steps:
2626
- uses: actions/checkout@v2
2727
- name: Build the Docker image

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ This was initially based on the [DevContainer for HIE (Haskell IDE Engine)](http
149149

150150
To build the image locally, just run `docker build ./.devcontainer/ --file ./.devcontainer/Dockerfile --tag haskelldevenv:latest` in the repository root.
151151

152-
You can override GHC version, Cabal version, Stack resolver and HLS version by specifying `GHC_VERSION=...`, `CABAL_VERSION=...`, `STACK_RESOLVER=...` and `HLS_VERSION=...` respectively as a build args.
152+
You can override GHC version, Cabal version, Stack resolver and HLS version by specifying `GHC_VERSION=...`, `CABAL_VERSION=...`, `STACK_RESOLVER=...` and `HLS_VERSION=...` respectively as build args.
153153

154154
For example:
155155

0 commit comments

Comments
 (0)