-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
119 lines (110 loc) · 5.19 KB
/
Dockerfile
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
ARG CARDANO_NODE_COMMIT=master
# misc
## Dockerfile.src
#FROM repsistance/cardano-node:src-${CARDANO_NODE_COMMIT} AS src
## Dockerfile.src-build
#FROM repsistance/cardano-node:src-build-${CARDANO_NODE_COMMIT} AS src-build
## Dockerfile.bin-build
FROM repsistance/cardano-node:bin-build-${CARDANO_NODE_COMMIT} AS bin-build
## nixos assets
#FROM nixos/nix AS github-nix-assets
#RUN nix-env -iA nixpkgs.curl
#RUN curl -s https://raw.githubusercontent.com/input-output-hk/cardano-ops/master/topologies/ff-peers.nix \
# | nix-instantiate --eval --json - > /var/tmp/ff-peers.json
# production base
FROM ubuntu:20.04 AS base
STOPSIGNAL SIGINT
VOLUME ["/opt/cardano/cnode/logs", "/opt/cardano/cnode/db", "/opt/cardano/cnode/priv"]
ENV APT_ARGS="-y -o APT::Install-Suggests=false -o APT::Install-Recommends=false"
ARG BASE_PACKAGES="git bash jq libatomic1 sudo wget curl screen python3-pip netbase net-tools dnsutils bc systemd gpg gpg-agent libsodium23 libsodium-dev wget vim bsdmainutils socat tcptraceroute iproute2 less liblz4-tool"
ENV BASE_PACKAGES ${BASE_PACKAGES}
ENV GUILD_OPS_BRANCH master
ENV GUILD_OPS_GIT_REPO https://github.com/cardano-community/guild-operators.git
ENV GUILD_OPS_HOME /opt/cardano/guild-operators
ENV CNODE_HOME /opt/cardano/cnode
ENV CARDANO_NODE_SOCKET_PATH /opt/cardano/cnode/sockets/node0.socket
ENV CARDANO_WALLET_TAG=v2021-11-11
ADD ./baids/00-cardano-wallet-binaries-setup /tmp/00-cardano-wallet-binaries-setup
RUN mkdir -p /nonexistent /data && \
chown nobody: /nonexistent && \
mkdir -p ${CNODE_HOME} && \
chown -R nobody: ${CNODE_HOME}/..
RUN apt-get update -qq && \
DEBIAN_FRONTEND=noninteractive apt-get install ${APT_ARGS} ${BASE_PACKAGES} ${BUILD_PACKAGES} && \
pip3 install yq && \
git clone --single-branch --branch ${GUILD_OPS_BRANCH} ${GUILD_OPS_GIT_REPO} ${GUILD_OPS_HOME} && \
ln -s ${GUILD_OPS_HOME}/scripts/cnode-helper-scripts ${CNODE_HOME}/scripts && \
ln -s ${CNODE_HOME}/files/configuration.json ${CNODE_HOME}/ptn0.json && \
bash -c 'source /tmp/00-cardano-wallet-binaries-setup && \
set -e; cardano-wallet-download-binaries linux64 ${CARDANO_WALLET_TAG}' && \
curl -sLo /tmp/cardano-hw-cli.deb https://github.com/vacuumlabs/cardano-hw-cli/releases/download/v1.10.0/cardano-hw-cli_1.10.0-1.deb && sudo dpkg -i /tmp/cardano-hw-cli.deb
COPY --from=bin-build /output/bin/* /usr/local/bin/
USER nobody
RUN curl -sSL https://raw.githubusercontent.com/rcmorano/baids/master/baids | bash -s install
COPY baids/* /nonexistent/.baids/functions.d/
COPY ./assets /assets
USER nobody
## standalone images (no genesis/topology prefetched)
FROM base AS standalone-tn-base
ENV NETWORK=standalone-tn
RUN bash -c 'source /nonexistent/.baids/baids && ${NETWORK}-setup'
CMD ["bash", "-c", "chown -R nobody: ${CNODE_HOME} && sudo -EHu nobody bash -c 'source ~/.baids/baids && ${NETWORK}-cnode-run-as-${CNODE_ROLE}'"]
FROM standalone-tn-base AS standalone-tn-passive
ENV CNODE_ROLE=passive
FROM standalone-tn-base AS standalone-tn-leader
ENV CNODE_ROLE=leader
## iohk images
### mainnet
FROM base AS iohk-mn-base
ENV NETWORK=iohk-mn
RUN bash -c 'source /nonexistent/.baids/baids && ${NETWORK}-setup'
USER root
CMD ["bash", "-c", "chown -R nobody: ${CNODE_HOME} && sudo -EHu nobody bash -c 'source ~/.baids/baids && ${NETWORK}-cnode-run-as-${CNODE_ROLE}'"]
FROM iohk-mn-base AS iohk-mn-passive
ENV CNODE_ROLE=passive
FROM iohk-mn-base AS iohk-mn-leader
ENV CNODE_ROLE=leader
### testnet
FROM base AS iohk-tn-base
ENV NETWORK=iohk-tn
RUN bash -c 'source /nonexistent/.baids/baids && ${NETWORK}-setup'
USER root
CMD ["bash", "-c", "chown -R nobody: ${CNODE_HOME} && sudo -EHu nobody bash -c 'source ~/.baids/baids && ${NETWORK}-cnode-run-as-${CNODE_ROLE}'"]
FROM iohk-tn-base AS iohk-tn-passive
ENV CNODE_ROLE=passive
FROM iohk-tn-base AS iohk-tn-leader
ENV CNODE_ROLE=leader
### preview
FROM base AS iohk-preview-base
ENV NETWORK=iohk-preview
RUN bash -c 'source /nonexistent/.baids/baids && ${NETWORK}-setup'
USER root
CMD ["bash", "-c", "chown -R nobody: ${CNODE_HOME} && sudo -EHu nobody bash -c 'source ~/.baids/baids && ${NETWORK}-cnode-run-as-${CNODE_ROLE}'"]
FROM iohk-preview-base AS iohk-preview-passive
ENV CNODE_ROLE=passive
FROM iohk-preview-base AS iohk-preview-leader
ENV CNODE_ROLE=leader
### preprod
FROM base AS iohk-preprod-base
ENV NETWORK=iohk-preprod
RUN bash -c 'source /nonexistent/.baids/baids && ${NETWORK}-setup'
USER root
CMD ["bash", "-c", "chown -R nobody: ${CNODE_HOME} && sudo -EHu nobody bash -c 'source ~/.baids/baids && ${NETWORK}-cnode-run-as-${CNODE_ROLE}'"]
FROM iohk-preprod-base AS iohk-preprod-passive
ENV CNODE_ROLE=passive
FROM iohk-preprod-base AS iohk-preprod-leader
ENV CNODE_ROLE=leader
### sanchonet
FROM base AS iohk-sanchonet-base
ENV NETWORK=iohk-sanchonet
RUN bash -c 'source /nonexistent/.baids/baids && ${NETWORK}-setup'
USER root
CMD ["bash", "-c", "chown -R nobody: ${CNODE_HOME} && sudo -EHu nobody bash -c 'source ~/.baids/baids && ${NETWORK}-cnode-run-as-${CNODE_ROLE}'"]
FROM iohk-sanchonet-base AS iohk-sanchonet-passive
ENV CNODE_ROLE=passive
FROM iohk-sanchonet-base AS iohk-sanchonet-leader
ENV CNODE_ROLE=leader
## distroless poc
FROM gcr.io/distroless/base AS barebone-node
COPY --from=bin-build /output/cardano* /usr/local/bin/
CMD ["/usr/local/bin/cardano-node"]