diff --git a/Dockerfile b/Dockerfile index 8bd11704..df5ebf99 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,29 +3,28 @@ # 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 +# $ docker run -it -p 8080:8080 siddhu/hackage-server # -FROM ubuntu:18.04 +FROM haskell:9.10.1-slim-bullseye + +RUN apt-get update && cabal update -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 DEBIAN_FRONTEND=noninteractive apt-get install -y \ + libbrotli-dev \ + libgd-dev \ + libicu-dev \ + libssl-dev \ + pkg-config \ + postfix \ + unzip \ + zlib1g-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 +RUN cabal build --only-dependencies --enable-tests -j +RUN cabal install hackage-repo-tool ENV PATH /root/.cabal/bin:$PATH ADD . ./ RUN hackage-repo-tool create-keys --keys keys @@ -33,17 +32,13 @@ 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 +RUN cabal build +#RUN cabal test +RUN cabal install all # setup server runtime environment -RUN mkdir /runtime -RUN cp -r /build/datafiles /runtime/datafiles WORKDIR /runtime +RUN cp -r /build/datafiles /runtime/datafiles RUN hackage-server init --static-dir=datafiles -CMD hackage-server run --static-dir=datafiles +CMD hackage-server run --static-dir=datafiles --ip=0.0.0.0 --base-uri=http://localhost:8080 EXPOSE 8080