Skip to content

Commit a548606

Browse files
authored
Merge pull request cardano-foundation#6 from cardano-foundation/livio/compose
Initial test setup
2 parents a8ebdcb + f8e6f01 commit a548606

28 files changed

+2368
-1
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Ignore vim files:
2+
*~
3+
*.swp
4+
*.swo
5+
6+
# compose
7+
compose/.testnet.yaml

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright [yyyy] [name of copyright owner]
189+
Copyright 2025 Cardano Stiftung
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

compose/Dockerfile.compiled

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
FROM docker.io/debian:stable-slim AS build
2+
3+
ARG CARDANO_NODE_VERSION="${CARDANO_NODE_VERSION:-10.2.1}"
4+
ARG UV_VERSION="${UV_VERSION:-0.6.11}"
5+
6+
# Set time zone
7+
ENV TZ="UTC"
8+
RUN ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime && \
9+
echo ${TZ} > /etc/timezone
10+
11+
# Install packages required in build stage
12+
RUN apt update && \
13+
apt install -y --no-install-recommends \
14+
ca-certificates \
15+
curl \
16+
git \
17+
tar
18+
19+
# Create cardano-node source directory
20+
RUN install --directory --owner=root --group=root --mode=0755 /usr/local/src/cardano-node
21+
22+
# Download cardano-node archive
23+
RUN curl --proto '=https' --tlsv1.2 \
24+
--location https://github.com/IntersectMBO/cardano-node/releases/download/${CARDANO_NODE_VERSION}/cardano-node-${CARDANO_NODE_VERSION}-linux.tar.gz \
25+
--output /usr/local/src/cardano-node/cardano-node-${CARDANO_NODE_VERSION}-linux.tar.gz
26+
27+
# Create cardano-node version directory
28+
RUN install --directory --owner=root --group=root --mode=0755 /usr/local/src/cardano-node/${CARDANO_NODE_VERSION}
29+
30+
# Unarchive cardano-node tarball
31+
RUN tar --extract --gzip --file=/usr/local/src/cardano-node/cardano-node-${CARDANO_NODE_VERSION}-linux.tar.gz --directory=/usr/local/src/cardano-node/${CARDANO_NODE_VERSION}
32+
33+
# Make cardano-cli executable
34+
RUN chmod 0755 /usr/local/src/cardano-node/${CARDANO_NODE_VERSION}/bin/cardano-cli \
35+
/usr/local/src/cardano-node/${CARDANO_NODE_VERSION}/bin/cardano-node
36+
37+
# Create cardano-cli symlink
38+
RUN ln -s /usr/local/src/cardano-node/${CARDANO_NODE_VERSION}/bin/cardano-cli /usr/local/bin/cardano-cli && \
39+
ln -s /usr/local/src/cardano-node/${CARDANO_NODE_VERSION}/bin/cardano-node /usr/local/bin/cardano-node
40+
41+
# Create uv source directory
42+
RUN install --directory --owner=root --group=root --mode=0755 /usr/local/src/uv
43+
44+
# Download uv archive
45+
RUN curl --proto '=https' --tlsv1.2 \
46+
--location https://github.com/astral-sh/uv/releases/download/${UV_VERSION}/uv-x86_64-unknown-linux-gnu.tar.gz \
47+
--output /usr/local/src/uv/uv-x86_64-unknown-linux-gnu.tar.gz
48+
49+
# Download uv checksum
50+
RUN curl --proto '=https' --tlsv1.2 \
51+
--location https://github.com/astral-sh/uv/releases/download/${UV_VERSION}/uv-x86_64-unknown-linux-gnu.tar.gz.sha256 \
52+
--output /usr/local/src/uv/uv-x86_64-unknown-linux-gnu.tar.gz.sha256
53+
54+
# Verify uv checksum
55+
WORKDIR /usr/local/src/uv
56+
RUN sha256sum --ignore-missing --check uv-x86_64-unknown-linux-gnu.tar.gz.sha256
57+
58+
# Unarchive uv tarball
59+
RUN tar --extract --gzip --file=/usr/local/src/uv/uv-x86_64-unknown-linux-gnu.tar.gz --directory=/usr/local/src/uv
60+
61+
# Make uv executable
62+
RUN chmod 0755 /usr/local/src/uv/uv-x86_64-unknown-linux-gnu/uv
63+
64+
# Create uv symlink
65+
RUN ln -s /usr/local/src/uv/uv-x86_64-unknown-linux-gnu/uv /usr/local/bin/uv
66+
67+
# Clone testnet-generation-tool.git repository
68+
WORKDIR /usr/local/src
69+
RUN git clone --branch main https://github.com/cardano-foundation/testnet-generation-tool.git
70+
71+
# Download testnet-generation-tool dependencies
72+
WORKDIR /usr/local/src/testnet-generation-tool
73+
RUN uv sync
74+
75+
# Copy testnet.yaml specification
76+
COPY --chown=root:root .testnet.yaml /usr/local/src/testnet-generation-tool/testnet.yaml
77+
78+
# Build testnet configuration files
79+
RUN uv run python3 genesis-cli.py testnet.yaml -o /tmp/testnet -c generate
80+
81+
# Remove dynamic topology.json
82+
RUN find /tmp/testnet -type f -name 'topology.json' -exec rm -f '{}' ';'
83+
84+
#---------------------------------------------------------------------
85+
86+
FROM docker.io/debian:stable-slim AS main
87+
88+
# Set environment variables
89+
ENV CARDANO_NODE_SOCKET_PATH="/opt/cardano-node/data/db/node.socket"
90+
91+
# Set time zone
92+
ENV TZ="UTC"
93+
RUN ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime && \
94+
echo ${TZ} > /etc/timezone
95+
96+
# Install packages required in main stage
97+
RUN apt update && \
98+
apt install -y --no-install-recommends \
99+
dnsutils \
100+
iproute2 \
101+
iputils-ping \
102+
jq \
103+
less \
104+
lsof \
105+
netbase \
106+
netcat-openbsd \
107+
openssl \
108+
procps \
109+
tcpdump \
110+
telnet \
111+
vim
112+
113+
# Copy binaries from build stage
114+
COPY --from=build --chown=root:root /usr/local/bin/cardano-cli /usr/local/bin/cardano-cli
115+
COPY --from=build --chown=root:root /usr/local/bin/cardano-node /usr/local/bin/cardano-node
116+
117+
# Create cardano group and user
118+
RUN groupadd --gid 10000 cardano && \
119+
useradd --comment 'cardano' --create-home --gid 10000 --password '!' --shell '/bin/bash' --uid 10000 cardano
120+
121+
# Create cardano-node directories
122+
RUN install --directory --owner=root --group=root --mode=0755 /opt/cardano-node && \
123+
install --directory --owner=cardano --group=cardano --mode=0750 /opt/cardano-node/config && \
124+
install --directory --owner=cardano --group=cardano --mode=0750 /opt/cardano-node/data && \
125+
install --directory --owner=cardano --group=cardano --mode=0750 /opt/cardano-node/data/db && \
126+
install --directory --owner=cardano --group=cardano --mode=0750 /opt/cardano-node/log && \
127+
install --directory --owner=cardano --group=cardano --mode=0750 /opt/cardano-node/pools
128+
129+
# Copy pool config and key material
130+
COPY --from=build --chown=cardano:cardano /tmp/testnet/pools /opt/cardano-node/pools
131+
COPY --from=build --chown=cardano:cardano /tmp/testnet/utxos /opt/cardano-node/utxos
132+
133+
# Copy canary_tx.sh
134+
COPY canary_tx.sh /
135+
RUN chmod 0755 /canary_tx.sh
136+
137+
# Copy cardano-node.sh
138+
COPY cardano-node.sh /
139+
RUN chmod 0755 /cardano-node.sh
140+
141+
USER cardano
142+
#STOPSIGNAL SIGINT
143+
144+
CMD ["/cardano-node.sh"]

0 commit comments

Comments
 (0)