forked from aniketd/docker-ghcup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
89 lines (76 loc) · 2.5 KB
/
Dockerfile
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
FROM debian:bookworm-slim
ARG GHCUP_DWN_URL=https://downloads.haskell.org/~ghcup/x86_64-linux-ghcup
ARG PATH
RUN test -n ${PATH}
ENV PATH=${PATH}
ENV LANG=C.UTF-8
ENV BOOTSTRAP_HASKELL_NONINTERACTIVE=1
RUN \
apt-get update -y && \
apt-get install -y --no-install-recommends \
curl \
libnuma-dev \
zlib1g-dev \
libgmp-dev \
libgmp10 \
git \
wget \
lsb-release \
software-properties-common \
gnupg2 \
apt-transport-https \
gcc \
autoconf \
automake \
libffi-dev \
libffi8 \
libgmp-dev \
libgmp10 \
libncurses-dev \
libncurses5 \
libtinfo5 \
libblas3 \
liblapack3 \
liblapack-dev \
libblas-dev \
xz-utils \
ssh \
vim \
build-essential
# install gpg keys
RUN \
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 7D1E8AFD1D4A16D71FADA2F2CCC85C0E40C06A8C && \
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys FE5AB6C91FEA597C3B31180B73EDE9E8CFBAEF01 && \
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 88B57FCF7DB53B4DB3BFA4B1588764FBE22D19C4 && \
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys EAF2A9A722C0C96F2B431CA511AAD8CEDEE0CAEF
# install ghcup
RUN \
curl ${GHCUP_DWN_URL} > /usr/bin/ghcup && \
chmod +x /usr/bin/ghcup && \
ghcup config set gpg-setting GPGStrict
ARG VERSION_GHC=9.4.8
ARG VERSION_CABAL=latest
ARG VERSION_STACK=latest
ARG USER_NAME=haskell
ARG USER_UID=1000
ARG USER_GID=$USER_UID
# Create the user
RUN groupadd --gid ${USER_GID} ${USER_NAME} \
&& useradd --uid ${USER_UID} --gid ${USER_GID} --no-log-init --create-home -m ${USER_NAME} -s /usr/bin/bash \
#
# [Optional] Add sudo support. Omit if you don't need to install software after connecting.
&& apt-get install -y sudo \
&& echo ${USER_NAME} ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USER_NAME} \
&& chmod 0440 /etc/sudoers.d/${USER_NAME}
RUN groupadd docker && \
usermod -aG docker ${USER_NAME}
USER ${USER_NAME}
WORKDIR /home/${USER_NAME}
# install GHC, cabal and stack
RUN \
ghcup -v install ghc --force ${VERSION_GHC} && \
ghcup -v install cabal --force ${VERSION_CABAL} && \
ghcup -v install stack --force ${VERSION_STACK} && \
ghcup set ghc ${VERSION_GHC} && \
ghcup install hls
RUN /bin/echo -e "\nexport PATH=$PATH:/home/${USER_NAME}/.ghcup/bin:/home/${USER_NAME}/.local/bin/\n" >> /home/${USER_NAME}/.bashrc