Skip to content

Commit

Permalink
fix Dockerfile
Browse files Browse the repository at this point in the history
The provided Dockerfile was outdated, from using a 'cabal-install'
version that couldn't parse the cabal.project file (running into
<haskell/cabal#6013>) to using a ghc that
didn't have the required 'base' version.
  • Loading branch information
mauke committed Jan 10, 2025
1 parent 5252a9c commit 35401c2
Showing 1 changed file with 20 additions and 25 deletions.
45 changes: 20 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,42 @@
# 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
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

0 comments on commit 35401c2

Please sign in to comment.