This repository was archived by the owner on Aug 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
68 lines (54 loc) · 2.11 KB
/
Copy pathDockerfile
File metadata and controls
68 lines (54 loc) · 2.11 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
FROM ubuntu:focal-20210827
ARG USER=haskell
ARG UID=1000
ARG GID=1000
ARG DEBIAN_FRONTEND=noninteractive
ARG STACK_VERSION=2.7.5
ENV LANG=C.UTF-8
ENV PATH=/home/$USER/.ghcup/bin:/stack/bin:/usr/lib/postgresql/13/bin:$PATH
# Create a default home for the default user & allow any user to sudo
RUN groupadd -g "$GID" $USER \
&& useradd --create-home --uid "$UID" --gid "$GID" "$USER" \
&& mkdir -p /etc/sudoers.d/ \
&& echo "$USER ALL=(ALL) NOPASSWD: ALL" > "/etc/sudoers.d/$USER" \
&& chown -R "$USER":"$USER" /home/$USER
# Have a default work directory. Chances are your configs will override this to provide a better
# experience like terminal click to go to definition.
WORKDIR "/home/$USER"
RUN apt-get update -y && apt-get install -y gnupg curl ca-certificates
RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg >/dev/null
RUN echo "deb http://apt.postgresql.org/pub/repos/apt focal-pgdg main" > /etc/apt/sources.list.d/pgdg.list
RUN apt-get update -y \
&& apt-get install -y \
curl \
gcc \
git \
gzip \
libgmp-dev \
liblzma-dev \
libncurses5-dev \
libpq-dev \
make \
netcat-openbsd \
perl \
postgresql-13 \
sudo \
tar \
wget \
xz-utils \
zip \
zlib1g-dev \
&& apt-get autoremove
# Own stack's working directory and allow any user to write to it. This is a "shared" stack
# directory that any user is capable to writing/reading/executing to. For the most part users will
# execute with UID 1000 and will not have to worry about the extended permissions. But if you're
# using a non-standard UID then you would have to execute this image with a different UID and would
# still have to have access to this directory.
RUN mkdir -p /stack && chown -R $USER:$USER /stack
ENV STACK_ROOT="/stack/.stack"
# Copy stack.yaml with overriden packages and extra-deps
COPY --chown=$UID:$GID config.yaml /stack/.stack/config.yaml
COPY --chown=$UID:$GID stack.yaml /stack/.stack/global-project/stack.yaml
USER "$USER"
COPY --chown=$UID:$GID install.sh /home/$USER/install.sh
RUN /home/$USER/install.sh