forked from abracadaniel/cardano-pool-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.voting
62 lines (54 loc) · 2.49 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
57
58
59
60
61
62
FROM debian:stable-slim as build
LABEL maintainer="[email protected]"
# 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 \
&& apt-get clean
# Install cabal
ENV PATH="/root/.cabal/bin:/root/.ghcup/bin:/root/.local/bin:$PATH"
RUN wget https://downloads.haskell.org/~cabal/cabal-install-3.2.0.0/cabal-install-3.2.0.0-x86_64-unknown-linux.tar.xz \
&& tar -xf cabal-install-3.2.0.0-x86_64-unknown-linux.tar.xz \
&& rm cabal-install-3.2.0.0-x86_64-unknown-linux.tar.xz cabal.sig \
&& mkdir -p ~/.local/bin \
&& mv cabal ~/.local/bin/ \
&& cabal update && cabal --version
# Install GHC
RUN wget https://downloads.haskell.org/ghc/8.10.2/ghc-8.10.2-x86_64-deb9-linux.tar.xz \
&& tar -xf ghc-8.10.2-x86_64-deb9-linux.tar.xz \
&& rm ghc-8.10.2-x86_64-deb9-linux.tar.xz \
&& cd ghc-8.10.2 \
&& ./configure \
&& make install \
&& cd / \
&& rm -rf /ghc-8.10.2
# Install libsodium
RUN git clone https://github.com/input-output-hk/libsodium \
&& cd libsodium \
&& git checkout 66f017f1 \
&& ./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"]