-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile_from_scratch
45 lines (37 loc) · 1.52 KB
/
Dockerfile_from_scratch
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
# Generate a fresh Docker image containing all the dependencies that
# we need to run the web app (and manage it over SSH).
#
# Usage:
# docker build . -f Dockerfile_from_scratch -t penelopeysm/apribot && docker push penelopeysm/apribot
#
# After this is done, the main Dockerfile will just pull from this pre-built
# image, meaning that we don't have to re-build the dependencies every time we
# deploy.
FROM nikolaik/python-nodejs:python3.11-nodejs20
WORKDIR /
# Copy Haskell bits
WORKDIR /hs
COPY ./hs/app ./app
COPY ./hs/python ./python
COPY ./hs/static ./static
COPY ./hs/apribot.cabal .
COPY ./hs/cabal.project .
COPY ./hs/cabal.project.freeze .
# Set up Haskell: see https://stackoverflow.com/a/71513191
RUN curl https://downloads.haskell.org/~ghcup/x86_64-linux-ghcup > /usr/bin/ghcup && chmod +x /usr/bin/ghcup
# discord-haskell doesn't work with GHC 9.6, so we stick to 9.4
RUN ghcup -v install ghc --isolate /usr/local --force 9.4.5 && ghcup -v install cabal --isolate /usr/local/bin --force 3.6.2.0
# This line circumvents a spurious error with cabal.project's git submodule.
# It should go away if I ever upload reddit-oauth2 to Hackage
RUN git config --global --add safe.directory '*'
RUN cabal update && cabal build
# Install Python packages and supervisor
RUN python -m pip install --upgrade pip setuptools \
&& python -m pip install -r python/requirements.txt \
&& python -m pip install supervisor
# Install nginx
RUN apt update && apt install -y nginx
# Launch a shell
WORKDIR /
CMD ["/bin/bash"]
# vim: ft=dockerfile