forked from IntersectMBO/cardano-node
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile.submitapi
48 lines (42 loc) · 8.99 KB
/
Dockerfile.submitapi
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
FROM debian:stable-slim as build
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 python3 htop nload pkg-config liblmdb-dev && mkdir -p /usr/local/lib/pkgconfig/ \
&& apt-get clean
RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_GHC_VERSION=8.10.7 BOOTSTRAP_HASKELL_CABAL_VERSION=3.8.1.0 BOOTSTRAP_HASKELL_INSTALL_STACK=1 BOOTSTRAP_HASKELL_INSTALL_HLS=1 BOOTSTRAP_HASKELL_ADJUST_BASHRC=P sh
ENV PATH="/root/.cabal/bin:/root/.ghcup/bin:/root/.local/bin:$PATH"
RUN git clone https://github.com/supranational/blst && cd blst && git checkout v0.3.10 && ./build.sh && echo cHJlZml4PS91c3IKZXhlY19wcmVmaXg9JHtwcmVmaXh9CmxpYmRpcj0ke2V4ZWNfcHJlZml4fS9saWIKaW5jbHVkZWRpcj0ke3ByZWZpeH0vaW5jbHVkZQoKTmFtZTogbGliYmxzdApEZXNjcmlwdGlvbjogTXVsdGlsaW5ndWFsIEJMUzEyLTM4MSBzaWduYXR1cmUgbGlicmFyeQpVUkw6IGh0dHBzOi8vZ2l0aHViLmNvbS9zdXByYW5hdGlvbmFsL2Jsc3QKVmVyc2lvbjogMC4zLjEwCkNmbGFnczogLUkke2luY2x1ZGVkaXJ9CkxpYnM6IC1MJHtsaWJkaXJ9IC1sYmxzdA== | base64 --decode >> libblst.pc && cp libblst.pc /usr/lib/pkgconfig/ && cp bindings/blst_aux.h bindings/blst.h bindings/blst.hpp /usr/include/ && cp libblst.a /usr/lib && chmod u=rw,go=r /usr/lib/libblst.a && chmod u=rw,go=r /usr/lib/pkgconfig/libblst.pc && chmod u=rw,go=r /usr/include/blst.h && chmod u=rw,go=r /usr/include/blst.hpp && chmod u=rw,go=r /usr/include/blst_aux.h
RUN mkdir secp256k1-sources && cd secp256k1-sources && git clone https://github.com/bitcoin-core/secp256k1.git && cd secp256k1 && git reset --hard ac83be33d0956faf6b7f61a60ab524ef7d6a473a && ./autogen.sh && ./configure --prefix=/usr --enable-module-schnorrsig --enable-experimental && make && make check && make install
RUN git clone https://github.com/input-output-hk/libsodium && cd libsodium && git checkout $(curl -L https://github.com/input-output-hk/iohk-nix/releases/latest/download/INFO | awk '$1 == "debian.libsodium-vrf.deb" { rev = gensub(/.*-(.*)\.deb/, "\\1", "g", $2); print rev }') && ./autogen.sh && ./configure && make && make check && make install
ENV LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" \
PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
RUN echo "Building tags/$VERSION..."
RUN touch cabal.project.local
COPY . .
RUN cabal clean \
&& cabal update \
&& cabal configure --with-compiler=ghc-8.10.7 \
&& echo "package cardano-crypto-praos" >> cabal.project.local \
&& echo " flags: -external-libsodium-vrf" >> cabal.project.local \
&& cabal build all \
&& mkdir -p /root/.local/bin/ \
&& cp -p dist-newstyle/build/x86_64-linux/ghc-8.10.7/cardano-submit-api-*/x/cardano-submit-api/build/cardano-submit-api/cardano-submit-api /root/.local/bin/
FROM debian:stable-slim
COPY --from=build /root/.local/bin/ /bin/
COPY --from=build /usr/local/lib/ /lib/
RUN apt-get update && apt-get install git -y
RUN 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 pkg-config && mkdir -p /usr/local/lib/pkgconfig/
RUN git clone https://github.com/supranational/blst && cd blst && git checkout v0.3.10 && ./build.sh && echo cHJlZml4PS91c3IKZXhlY19wcmVmaXg9JHtwcmVmaXh9CmxpYmRpcj0ke2V4ZWNfcHJlZml4fS9saWIKaW5jbHVkZWRpcj0ke3ByZWZpeH0vaW5jbHVkZQoKTmFtZTogbGliYmxzdApEZXNjcmlwdGlvbjogTXVsdGlsaW5ndWFsIEJMUzEyLTM4MSBzaWduYXR1cmUgbGlicmFyeQpVUkw6IGh0dHBzOi8vZ2l0aHViLmNvbS9zdXByYW5hdGlvbmFsL2Jsc3QKVmVyc2lvbjogMC4zLjEwCkNmbGFnczogLUkke2luY2x1ZGVkaXJ9CkxpYnM6IC1MJHtsaWJkaXJ9IC1sYmxzdA== | base64 --decode >> libblst.pc && cp libblst.pc /usr/lib/pkgconfig/ && cp bindings/blst_aux.h bindings/blst.h bindings/blst.hpp /usr/include/ && cp libblst.a /usr/lib && chmod u=rw,go=r /usr/lib/libblst.a && chmod u=rw,go=r /usr/lib/pkgconfig/libblst.pc && chmod u=rw,go=r /usr/include/blst.h && chmod u=rw,go=r /usr/include/blst.hpp && chmod u=rw,go=r /usr/include/blst_aux.h
RUN mkdir secp256k1-sources && cd secp256k1-sources && git clone https://github.com/bitcoin-core/secp256k1.git && cd secp256k1 && git reset --hard ac83be33d0956faf6b7f61a60ab524ef7d6a473a && ./autogen.sh && ./configure --prefix=/usr --enable-module-schnorrsig --enable-experimental && make && make check && make install
RUN git clone https://github.com/input-output-hk/libsodium && cd libsodium && git checkout $(curl -L https://github.com/input-output-hk/iohk-nix/releases/latest/download/INFO | awk '$1 == "debian.libsodium-vrf.deb" { rev = gensub(/.*-(.*)\.deb/, "\\1", "g", $2); print rev }') && ./autogen.sh && ./configure && make && make check && make install
RUN groupadd -g 1001 cardano
RUN useradd -rm -d /home/cardano -s /bin/bash -g 1001 -G sudo -u 1001 cardano
RUN mkdir -p /home/cardano/data/db
RUN mkdir /home/cardano/ipc
RUN cd /home/cardano && git clone https://github.com/Emurgo/cardano-configurations.git
RUN chown -R 1001:1001 /home/cardano/ipc
RUN chown -R 1001:1001 /home/cardano/data
RUN chown -R 1001:1001 /home/cardano/cardano-configurations
USER 1001:1001
WORKDIR /home/cardano
RUN echo IyBUeCBTdWJtaXNzaW9uIFNlcnZlciBDb25maWd1cmF0aW9uCgpFbmFibGVMb2dNZXRyaWNzOiBGYWxzZQpFbmFibGVMb2dnaW5nOiBUcnVlCgojIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQojIExvZ2dpbmcgY29uZmlndXJhdGlvbiBmb2xsb3dzLgoKIyBnbG9iYWwgZmlsdGVyOyBtZXNzYWdlcyBtdXN0IGhhdmUgYXQgbGVhc3QgdGhpcyBzZXZlcml0eSB0byBwYXNzOgptaW5TZXZlcml0eTogSW5mbwoKIyBnbG9iYWwgZmlsZSByb3RhdGlvbiBzZXR0aW5nczoKcm90YXRpb246CiAgcnBMb2dMaW1pdEJ5dGVzOiA1MDAwMDAwCiAgcnBLZWVwRmlsZXNOdW06ICAxMAogIHJwTWF4QWdlSG91cnM6ICAgMjQKCiMgdGhlc2UgYmFja2VuZHMgYXJlIGluaXRpYWxpemVkOgpzZXR1cEJhY2tlbmRzOgogIC0gQWdncmVnYXRpb25CSwogIC0gS2F0aXBCSwogICMgLSBFZGl0b3JCSwogICMgLSBFS0dWaWV3QksKCiMgaWYgbm90IGluZGljYXRlZCBvdGhlcndpc2UsIHRoZW4gbWVzc2FnZXMgYXJlIHBhc3NlZCB0byB0aGVzZSBiYWNrZW5kczoKZ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cmFjZTogTm9UcmFjZQogICAgJ2NhcmRhbm8uI21lc3NhZ2Vjb3VudGVycy5hZ2dyZWdhdGlvbic6CiAgICAgIHN1YnRyYWNlOiBOb1RyYWNlCiAgICAnY2FyZGFuby4jbWVzc2FnZWNvdW50ZXJzLmVrZ3ZpZXcnOgogICAgICBzdWJ0cmFjZTogTm9UcmFjZQogICAgJ2NhcmRhbm8uI21lc3NhZ2Vjb3VudGVycy5zd2l0Y2hib2FyZCc6CiAgICAgIHN1YnRyYWNlOiBOb1RyYWNlCiAgICAnY2FyZGFuby4jbWVzc2FnZWNvdW50ZXJzLmthdGlwJzoKICAgICAgc3VidHJhY2U6IE5vVHJhY2UKICAgICdjYXJkYW5vLiNtZXNzYWdlY291bnRlcnMubW9uaXRvcmluZyc6CiAgICAgIHN1YnRyYWNlOiBOb1RyYWNlCiAgbWFwQmFja2VuZHM6CiAgICBjYXJkYW5vLmVwb2NoLXZhbGlkYXRpb24uYmVuY2htYXJrOgogICAgICAtIEFnZ3JlZ2F0aW9uQksKICAgICcjYWdncmVnYXRpb24uY2FyZGFuby5lcG9jaC12YWxpZGF0aW9uLmJlbmNobWFyayc6CiAgICAgIC0gRUtHVmlld0JLCg== | base64 --decode > /home/cardano/submit-api-config.yaml
ENTRYPOINT cardano-submit-api --config /home/cardano/submit-api-config.yaml --socket-path /home/cardano/ipc/node.socket --listen-address 0.0.0.0 --port 8090 --${NETWORK:-testnet-magic 1}