-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile.prover
44 lines (32 loc) · 1.56 KB
/
Dockerfile.prover
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
FROM fpco/stack-build-small:latest as dependencies
RUN mkdir /opt/build
WORKDIR /opt/build
# GHC dynamically links its compilation targets to lib gmp
RUN apt-get update && apt-get download libgmp10
RUN mv libgmp*.deb libgmp.deb
RUN apt-get install -y libexpat1-dev liblmdb-dev liblzma-dev libz-dev pkg-config
# Docker build should not use cached layer if any of these is modified
COPY stack.yaml /opt/build/
COPY package-template.yaml /opt/build/package.yaml
RUN stack build rpki-prover:rpki-prover --system-ghc --dependencies-only
# -------------------------------------------------------------------------------------------
FROM fpco/stack-build-small:latest as build
# Copy compiled dependencies from previous stage
COPY --from=dependencies /root/.stack /root/.stack
COPY . /opt/build/
WORKDIR /opt/build
RUN apt-get update && apt-get install -y libexpat1-dev liblmdb-dev liblzma-dev libz-dev pkg-config
RUN stack build rpki-prover:rpki-prover --system-ghc
RUN mv "$(stack path --local-install-root --system-ghc)/bin" /opt/build/bin
# -------------------------------------------------------------------------------------------
# Base image for stack build so compiled artifact from previous
# stage should run
FROM ubuntu:22.04 as prover
# Add the libraries we need to run the application
RUN apt-get update && apt-get install -y libgmp-dev libexpat1-dev liblmdb-dev liblzma-dev curl rsync libz-dev
VOLUME /rpki-data/
RUN mkdir -p /opt/app
WORKDIR /opt/app
COPY --from=build /opt/build/bin .
EXPOSE 9999
ENTRYPOINT [ "/opt/app/rpki-prover", "--rpki-root-directory", "/rpki-data" ]