Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Dockerfile #1356

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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