diff --git a/Dockerfile b/Dockerfile index 5913057f2..9a8c8d8f2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,59 +10,43 @@ # Docker> # hackage-server run --static-dir=datafiles # +# Set up the system environment. FROM ubuntu - RUN apt-get update - -# Install apt-add-repository RUN apt-get install -y software-properties-common - -# Use Herbert's PPA on Ubuntu for getting GHC and cabal-install RUN apt-add-repository ppa:hvr/ghc - RUN apt-get update - -# Dependencies -RUN apt-get install -yy unzip libicu-dev postfix -RUN apt-get install -y ghc-8.2.1 cabal-install-2.0 +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y ghc-8.2.2 cabal-install-2.4 ENV PATH /opt/ghc/bin:$PATH -RUN cabal update - -# Required Header files -RUN apt-get install -y zlib1g-dev libssl-dev - -# haskell dependencies +RUN cabal v2-update + +# Install current HEAD version of cabal-install. +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y curl zlib1g-dev +WORKDIR /tmp +RUN curl --silent -L https://github.com/haskell/cabal/tarball/dc138034d469973fee43af86764567e4202ca84b | tar xz +WORKDIR /tmp/haskell-cabal-dc13803 +RUN cabal v2-install -j cabal-install +ENV PATH /root/.cabal/bin:$PATH + +# Build hackage-server. +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y zlib1g-dev libssl-dev unzip libicu-dev postfix RUN mkdir /build WORKDIR /build -ADD ./hackage-server.cabal ./hackage-server.cabal -RUN cabal sandbox init -# TODO: Switch to Nix-style cabal new-install -RUN cabal install --only-dependencies --enable-tests -j --force-reinstalls -ENV PATH /build/.cabal-sandbox/bin:$PATH - -# needed for creating TUF keys -RUN cabal install hackage-repo-tool - -# add code -# note: this must come after installing the dependencies, such that -# we don't need to rebuilt the dependencies every time the code changes -ADD . /build - -# generate keys (needed for tests) +ADD hackage-server.cabal cabal.project ./ +RUN cabal v2-build --only-dependencies --enable-tests +RUN cabal v2-install --help +RUN cabal v2-install --installdir=/root/.cabal/bin hackage-repo-tool +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 - -# build & test & install hackage -RUN cabal configure -f-build-hackage-mirror --enable-tests -RUN cabal 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 test -RUN cabal copy && cabal register +#RUN cabal v2-test +RUN cabal v2-install --installdir=/root/.cabal/bin all # setup server runtime environment RUN mkdir /runtime