forked from haskell/hackage-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
49 lines (45 loc) · 1.59 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
# Usage:
#
# Build the container
# $ docker build . -t siddhu/hackage-server
#
# Shell into the container
# $ docker run -it -p 8080:8080 siddhu/hackage-server /bin/bash
#
# Run the server
# Docker> # hackage-server run --static-dir=datafiles
#
FROM ubuntu:18.04
RUN apt-get update
RUN apt-get install -y software-properties-common
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y unzip libicu-dev postfix zlib1g-dev libssl-dev
RUN apt-add-repository ppa:hvr/ghc
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y ghc-8.2.2 cabal-install-3.0
ENV PATH /opt/ghc/bin:$PATH
RUN cabal v2-update
RUN mkdir /build
WORKDIR /build
ADD hackage-server.cabal cabal.project ./
RUN cabal v2-build --only-dependencies --enable-tests -j
RUN cabal v2-install hackage-repo-tool
ENV PATH /root/.cabal/bin:$PATH
ADD . ./
RUN hackage-repo-tool create-keys --keys keys
RUN cp keys/timestamp/*.private datafiles/TUF/timestamp.private
RUN cp keys/snapshot/*.private datafiles/TUF/snapshot.private
RUN hackage-repo-tool create-root --keys keys -o datafiles/TUF/root.json
RUN hackage-repo-tool create-mirrors --keys keys -o datafiles/TUF/mirrors.json
RUN cabal v2-build
# tests currently don't pass: the hackage-security work introduced some
# backup/restore errors (though they look harmless)
# see https://github.com/haskell/hackage-server/issues/425
#RUN cabal v2-test
RUN cabal v2-install all
# setup server runtime environment
RUN mkdir /runtime
RUN cp -r /build/datafiles /runtime/datafiles
WORKDIR /runtime
RUN hackage-server init --static-dir=datafiles
CMD hackage-server run --static-dir=datafiles
EXPOSE 8080