forked from abracadaniel/cardano-pool-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.voting
56 lines (49 loc) · 2.21 KB
/
Dockerfile.voting
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
45
46
47
48
49
50
51
52
53
54
55
56
FROM debian:buster-slim as build
LABEL maintainer="dro@arrakis.it"
# Install build dependencies
RUN apt-get update -y \
&& apt-get install -y automake build-essential pkg-config libffi-dev libgmp-dev libssl-dev libtinfo-dev libsystemd-dev zlib1g-dev make g++ tmux git jq wget libncursesw5 libtool autoconf libsqlite3-dev m4 ca-certificates gcc libc6-dev curl\
&& apt-get clean
# Install GHC
ENV CABAL_VERSION=3.6.0.0 \
GHC_VERSION=8.10.7 \
PATH="$HOME/.cabal/bin:/root/.ghcup/bin:$PATH"
RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh \
&& ghcup install ghc ${GHC_VERSION} \
&& ghcup install cabal ${CABAL_VERSION} \
&& ghcup set ghc ${GHC_VERSION} \
&& ghcup set cabal ${CABAL_VERSION}
# Install libsodium
ARG LIBSODIUM_VERSION
RUN git clone /~https://github.com/input-output-hk/libsodium \
&& cd libsodium \
&& git fetch --all --recurse-submodules --tags \
&& git tag \
&& git checkout $LIBSODIUM_VERSION \
&& ./autogen.sh \
&& ./configure \
&& make \
&& make install \
&& cd .. && rm -rf libsodium
ENV LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" \
PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
# Install voting-tools
WORKDIR /build
ARG VERSION
RUN git clone /~https://github.com/input-output-hk/voting-tools.git \
&& cd voting-tools \
&& git fetch --all --recurse-submodules --tags \
&& git tag
RUN apt-get install -y libpq-dev
RUN cd voting-tools/ \
&& cabal configure --with-compiler=ghc-8.10.2 \
&& echo "package cardano-crypto-praos" >> cabal.project.local \
&& echo " flags: -external-libsodium-vrf" >> cabal.project.local \
&& cabal build all
# Run
FROM debian:stable-slim
COPY --from=build /build/voting-tools/dist-newstyle/build/x86_64-linux/ghc-8.10.2/voting-tools-0.1.0.0/x/voting-tools/build/voting-tools/voting-tools /bin/
COPY --from=build /build/voting-tools/dist-newstyle/build/x86_64-linux/ghc-8.10.2/voter-registration-0.1.0.0/x/voter-registration/build/voter-registration /bin/
COPY --from=build /usr/local/lib/libsodium* /lib/
RUN chmod +x /bin/voter-registration && chmod +x /bin/voting-tools
ENTRYPOINT ["voter-registration"]