-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
73 lines (60 loc) · 2.58 KB
/
Dockerfile
File metadata and controls
73 lines (60 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
FROM mcr.microsoft.com/devcontainers/base:debian
# Avoid prompts from apt
ENV DEBIAN_FRONTEND=noninteractive
# 1. Install System Dependencies
RUN apt-get update && apt-get upgrade -y && apt-get install -y \
build-essential \
curl \
git \
libffi-dev \
libgmp-dev \
libssl-dev \
libtinfo-dev \
pkg-config \
zlib1g-dev \
socat \
procps \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# 2. Install Node.js 22 LTS from NodeSource (newer runtime with security patches)
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
apt-get install -y nodejs && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# 3. Install direnv from GitHub releases (newer Go build addresses stdlib CVEs)
RUN ARCH=$(dpkg --print-architecture) && \
curl -fsSL "https://github.com/direnv/direnv/releases/latest/download/direnv.linux-${ARCH}" -o /usr/local/bin/direnv && \
chmod +x /usr/local/bin/direnv
# 4. Install Claude Code CLI globally via NPM
RUN npm install -g @anthropic-ai/claude-code
# Switch to the non-root 'vscode' user provided by the base image
USER vscode
SHELL ["/bin/bash", "-c"]
# 5. Configure Haskell Environment Path
# Ensures ghcup, cabal, and stack binaries are prioritized in the PATH
ENV PATH="/home/vscode/.cabal/bin:/home/vscode/.local/bin:/home/vscode/.ghcup/bin:$PATH"
# 6. Install Haskell Toolchain (GHCup, GHC, Cabal, HLS, Stack)
# Using GHC 9.10.3 as the primary compiler version
RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | \
BOOTSTRAP_HASKELL_NONINTERACTIVE=1 \
BOOTSTRAP_HASKELL_GHC_VERSION=9.10.3 \
BOOTSTRAP_HASKELL_CABAL_VERSION=3.12.1.0 \
BOOTSTRAP_HASKELL_INSTALL_STACK=1 \
BOOTSTRAP_HASKELL_INSTALL_HLS=1 sh && \
ghcup set ghc 9.10.3
# 7. Install Haskell Tools (Hoogle, Ormolu, Fast-Tags, DAP Adapters)
RUN cabal update && \
cabal install hoogle fast-tags ormolu cabal-gild \
haskell-dap ghci-dap haskell-debug-adapter \
--overwrite-policy=always && \
hoogle generate
# 8. Cabal Performance Tuning
RUN mkdir -p ~/.cabal && \
echo "jobs: \$ncpus" >> ~/.cabal/config && \
echo "documentation: False" >> ~/.cabal/config
# 9. Shell Integration (Direnv & Welcome Message)
RUN echo 'eval "$(direnv hook bash)"' >> ~/.bashrc && \
echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc && \
echo -e "🖥️ Haskell Dev Env Ready!\n- Claude Code CLI\n- GHC 9.10.3\n- Tools: Hoogle, Ormolu, HLS" > /home/vscode/.welcome_message && \
echo 'cat /home/vscode/.welcome_message' >> ~/.bashrc
WORKDIR /workspaces/haskell
# Re-enable interactive prompts
ENV DEBIAN_FRONTEND=dialog