Skip to content

Commit 0474af3

Browse files
committed
fix(devnet): Docker images creation with CI mode
1 parent 78d4c0d commit 0474af3

File tree

6 files changed

+69
-12
lines changed

6 files changed

+69
-12
lines changed

mithril-aggregator/Dockerfile.ci

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ FROM $DOCKER_IMAGE_FROM
77
# Build-time platform architecture
88
ARG TARGETARCH
99

10+
# Upgrade
11+
RUN apt-get update -y && apt-get install -y libssl-dev ca-certificates wget adduser && apt-get clean && rm -rf /var/lib/apt/lists/*
12+
1013
# Create appuser
1114
RUN adduser --no-create-home --disabled-password appuser
1215

1316
# Precreate workdir
1417
RUN mkdir -p /app/bin
1518

16-
# Upgrade
17-
RUN apt-get update -y && apt-get install -y libssl-dev ca-certificates wget && apt-get clean && rm -rf /var/lib/apt/lists/*
18-
1919
# Install cardano-cli
2020
ARG CARDANO_NODE_VERSION=10.5.1
2121
ARG CARDANO_BIN_URL=https://github.com/input-output-hk/cardano-node/releases/download/$CARDANO_NODE_VERSION/cardano-node-$CARDANO_NODE_VERSION-linux.tar.gz

mithril-aggregator/Makefile

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,25 @@ build:
88
${CARGO} build --release
99
cp ../target/release/mithril-aggregator .
1010

11+
build-ci:
12+
# Check that we are on Linux, then build
13+
if [ "$$(uname -s)" != "Linux" ]; then \
14+
echo "Error: this target only supports Linux"; \
15+
exit 1; \
16+
fi; \
17+
RAW_ARCH=$$(uname -m); \
18+
if [ "$$RAW_ARCH" = "x86_64" ]; then \
19+
ARCH="amd64"; \
20+
elif [ "$$RAW_ARCH" = "aarch64" ]; then \
21+
ARCH="arm64"; \
22+
else \
23+
echo "Error: unsupported architecture $$RAW_ARCH"; \
24+
exit 1; \
25+
fi; \
26+
${CARGO} build --release; \
27+
mkdir -p ./bin-linux-$${ARCH}; \
28+
cp ../target/release/mithril-aggregator ./bin-linux-$${ARCH}/mithril-aggregator
29+
1130
run: build
1231
./mithril-aggregator serve
1332

@@ -31,7 +50,7 @@ doc:
3150
docker-build:
3251
cd ../ && docker build -t mithril/mithril-aggregator -f mithril-aggregator/Dockerfile .
3352

34-
docker-build-ci: build
53+
docker-build-ci: build-ci
3554
cd ../ && docker build -t mithril/mithril-aggregator -f mithril-aggregator/Dockerfile.ci --build-arg DOCKER_IMAGE_FROM --build-arg CARDANO_NODE_VERSION .
3655

3756
docker-run:

mithril-client-cli/Dockerfile.ci

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ FROM $DOCKER_IMAGE_FROM
77
# Build-time platform architecture
88
ARG TARGETARCH
99

10+
# Upgrade
11+
RUN apt-get update -y && apt-get install -y libssl-dev ca-certificates wget adduser && apt-get clean && rm -rf /var/lib/apt/lists/*
12+
1013
# Create appuser
1114
RUN adduser --disabled-password appuser
1215

1316
# Precreate workdir
1417
RUN mkdir -p /app/bin
1518

16-
# Upgrade
17-
RUN apt-get update -y && apt-get install -y libssl-dev ca-certificates wget && apt-get clean && rm -rf /var/lib/apt/lists/*
18-
1919
# Copy the executable
2020
COPY mithril-client-cli/bin-linux-$TARGETARCH/mithril-client /app/bin/mithril-client
2121

mithril-client-cli/Makefile

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,25 @@ build:
1313
${CARGO} build --release
1414
cp ../target/release/mithril-client .
1515

16+
build-ci:
17+
# Check that we are on Linux, then build
18+
if [ "$$(uname -s)" != "Linux" ]; then \
19+
echo "Error: this target only supports Linux"; \
20+
exit 1; \
21+
fi; \
22+
RAW_ARCH=$$(uname -m); \
23+
if [ "$$RAW_ARCH" = "x86_64" ]; then \
24+
ARCH="amd64"; \
25+
elif [ "$$RAW_ARCH" = "aarch64" ]; then \
26+
ARCH="arm64"; \
27+
else \
28+
echo "Error: unsupported architecture $$RAW_ARCH"; \
29+
exit 1; \
30+
fi; \
31+
${CARGO} build --release; \
32+
mkdir -p ./bin-linux-$${ARCH}; \
33+
cp ../target/release/mithril-client ./bin-linux-$${ARCH}/mithril-client
34+
1635
run: build
1736
@./mithril-client $(call args,defaultstring)
1837

@@ -39,7 +58,7 @@ doc:
3958
docker-build:
4059
cd ../ && docker build -t mithril/mithril-client -f mithril-client-cli/Dockerfile .
4160

42-
docker-build-ci: build
61+
docker-build-ci: build-ci
4362
cd ../ && docker build -t mithril/mithril-client -f mithril-client-cli/Dockerfile.ci --build-arg DOCKER_IMAGE_FROM .
4463

4564
docker-run:

mithril-signer/Dockerfile.ci

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ FROM $DOCKER_IMAGE_FROM
77
# Build-time platform architecture
88
ARG TARGETARCH
99

10+
# Upgrade
11+
RUN apt-get update -y && apt-get install -y libssl-dev ca-certificates wget adduser && apt-get clean && rm -rf /var/lib/apt/lists/*
12+
1013
# Create appuser
1114
RUN adduser --no-create-home --disabled-password appuser
1215

1316
# Precreate workdir
1417
RUN mkdir -p /app/bin
1518

16-
# Upgrade
17-
RUN apt-get update -y && apt-get install -y libssl-dev ca-certificates wget && apt-get clean && rm -rf /var/lib/apt/lists/*
18-
1919
# Install cardano-cli
2020
ARG CARDANO_NODE_VERSION=10.5.1
2121
ARG CARDANO_BIN_URL=https://github.com/input-output-hk/cardano-node/releases/download/$CARDANO_NODE_VERSION/cardano-node-$CARDANO_NODE_VERSION-linux.tar.gz

mithril-signer/Makefile

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,25 @@ build:
1111
run: build
1212
./mithril-signer
1313

14+
build-ci:
15+
# Check that we are on Linux, then build
16+
if [ "$$(uname -s)" != "Linux" ]; then \
17+
echo "Error: this target only supports Linux"; \
18+
exit 1; \
19+
fi; \
20+
RAW_ARCH=$$(uname -m); \
21+
if [ "$$RAW_ARCH" = "x86_64" ]; then \
22+
ARCH="amd64"; \
23+
elif [ "$$RAW_ARCH" = "aarch64" ]; then \
24+
ARCH="arm64"; \
25+
else \
26+
echo "Error: unsupported architecture $$RAW_ARCH"; \
27+
exit 1; \
28+
fi; \
29+
${CARGO} build --release; \
30+
mkdir -p ./bin-linux-$${ARCH}; \
31+
cp ../target/release/mithril-signer ./bin-linux-$${ARCH}/mithril-signer
32+
1433
debug:
1534
${CARGO} run -- -vvv
1635

@@ -31,7 +50,7 @@ doc:
3150
docker-build:
3251
cd ../ && docker build -t mithril/mithril-signer -f mithril-signer/Dockerfile .
3352

34-
docker-build-ci: build
53+
docker-build-ci: build-ci
3554
cd ../ && docker build -t mithril/mithril-signer -f mithril-signer/Dockerfile.ci --build-arg DOCKER_IMAGE_FROM --build-arg CARDANO_NODE_VERSION .
3655

3756
docker-run:

0 commit comments

Comments
 (0)