Skip to content

Commit cd1a33f

Browse files
authored
Download binaries for appropriate architecture in Docker images (#223)
1 parent 28267e8 commit cd1a33f

File tree

3 files changed

+45
-35
lines changed

3 files changed

+45
-35
lines changed

espresso/docker/l1-geth/Dockerfile

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -27,47 +27,47 @@ ENV DEBIAN_FRONTEND=noninteractive
2727

2828
# Install runtime dependencies
2929
RUN apt-get update && apt-get install -y \
30-
curl \
31-
jq \
32-
ca-certificates \
33-
openssl \
34-
&& rm -rf /var/lib/apt/lists/*
30+
curl \
31+
jq \
32+
ca-certificates \
33+
openssl \
34+
&& rm -rf /var/lib/apt/lists/*
3535

3636
# Install dasel for JSON manipulation
37-
RUN curl -sSL "https://github.com/TomWright/dasel/releases/latest/download/dasel_linux_amd64" -o /usr/local/bin/dasel && \
37+
RUN curl -sSL "https://github.com/TomWright/dasel/releases/latest/download/dasel_linux_$(dpkg --print-architecture)" -o /usr/local/bin/dasel && \
3838
chmod +x /usr/local/bin/dasel
3939

4040
# Install yq for YAML parsing
41-
RUN curl -sSL "https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64" -o /usr/local/bin/yq && \
41+
RUN curl -sSL "https://github.com/mikefarah/yq/releases/latest/download/yq_linux_$(dpkg --print-architecture)" -o /usr/local/bin/yq && \
4242
chmod +x /usr/local/bin/yq
4343

4444
# Install Geth for the given architecture.
4545
RUN ARCH=$(dpkg --print-architecture) && \
46-
echo "Detected architecture: $ARCH" && \
47-
case "$ARCH" in \
48-
"amd64") \
49-
GETH_URL="https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.15.11-36b2371c.tar.gz" && \
50-
GETH_SHA="a14a4285daedf75ea04a7a298e6caa48d566a2786c93fc5e86ec2c5998c92455" && \
51-
GETH_DIR="geth-linux-amd64-1.15.11-36b2371c" && \
52-
VERIFY_SHA="true" \
53-
;; \
54-
"arm64") \
55-
GETH_URL="https://gethstore.blob.core.windows.net/builds/geth-linux-arm64-1.15.11-36b2371c.tar.gz" && \
56-
GETH_SHA="148ec84db2268fa846ae68f6445f0c98d33e95069e40fe8c74b43ea5eb53df7b" && \
57-
GETH_DIR="geth-linux-arm64-1.15.11-36b2371c" && \
58-
VERIFY_SHA="true" \
59-
;; \
60-
*) \
61-
echo "Unsupported architecture: $ARCH" && exit 1 \
62-
;; \
63-
esac && \
64-
echo "Downloading: $GETH_URL" && \
65-
curl -L "$GETH_URL" -o geth.tar.gz && \
66-
echo "$GETH_SHA geth.tar.gz" | sha256sum -c - && \
67-
tar -xvf geth.tar.gz && \
68-
mv "$GETH_DIR/geth" /usr/local/bin/geth && \
69-
rm -rf geth.tar.gz "$GETH_DIR" && \
70-
chmod +x /usr/local/bin/geth
46+
echo "Detected architecture: $ARCH" && \
47+
case "$ARCH" in \
48+
"amd64") \
49+
GETH_URL="https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.15.11-36b2371c.tar.gz" && \
50+
GETH_SHA="a14a4285daedf75ea04a7a298e6caa48d566a2786c93fc5e86ec2c5998c92455" && \
51+
GETH_DIR="geth-linux-amd64-1.15.11-36b2371c" && \
52+
VERIFY_SHA="true" \
53+
;; \
54+
"arm64") \
55+
GETH_URL="https://gethstore.blob.core.windows.net/builds/geth-linux-arm64-1.15.11-36b2371c.tar.gz" && \
56+
GETH_SHA="148ec84db2268fa846ae68f6445f0c98d33e95069e40fe8c74b43ea5eb53df7b" && \
57+
GETH_DIR="geth-linux-arm64-1.15.11-36b2371c" && \
58+
VERIFY_SHA="true" \
59+
;; \
60+
*) \
61+
echo "Unsupported architecture: $ARCH" && exit 1 \
62+
;; \
63+
esac && \
64+
echo "Downloading: $GETH_URL" && \
65+
curl -L "$GETH_URL" -o geth.tar.gz && \
66+
echo "$GETH_SHA geth.tar.gz" | sha256sum -c - && \
67+
tar -xvf geth.tar.gz && \
68+
mv "$GETH_DIR/geth" /usr/local/bin/geth && \
69+
rm -rf geth.tar.gz "$GETH_DIR" && \
70+
chmod +x /usr/local/bin/geth
7171

7272
# Install lighthouse consensus tools
7373
RUN curl -sSL "https://github.com/sigp/lighthouse/releases/download/v5.3.0/lighthouse-v5.3.0-x86_64-unknown-linux-gnu.tar.gz" -o lighthouse.tar.gz && \

espresso/docker/op-geth/Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@ RUN echo "Cache bust: $(date)" > /cache-bust.txt
5959
RUN apk add curl jq openssl
6060

6161
# Install dasel for JSON manipulation.
62-
RUN curl -sSL "https://github.com/TomWright/dasel/releases/latest/download/dasel_linux_amd64" -o /usr/local/bin/dasel && \
63-
chmod +x /usr/local/bin/dasel
62+
RUN case $(uname -m) in \
63+
"arm64"|"aarch64") ARCH="arm64" ;; \
64+
*) ARCH="amd64" ;; \
65+
esac && \
66+
curl -sSL "https://github.com/TomWright/dasel/releases/latest/download/dasel_linux_$ARCH" -o /usr/local/bin/dasel && \
67+
chmod +x /usr/local/bin/dasel
6468

6569
# Copy binary from builder stage.
6670
COPY --from=op-deployer-builder /op-deployer /usr/local/bin/

espresso/docker/op-stack/Dockerfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,12 @@ FROM alpine:3.22 AS op-cgo-builder
6464
RUN apk add musl-dev gcc go g++ curl tar gzip make gcc linux-headers git jq bash yq
6565
# Install just from mise
6666
COPY ./mise.toml .
67-
RUN curl -L https://github.com/casey/just/releases/download/$(yq '.tools.just' mise.toml)/just-$(yq '.tools.just' mise.toml)-x86_64-unknown-linux-musl.tar.gz | \
67+
RUN uname -m
68+
RUN case $(uname -m) in \
69+
"arm64"|"aarch64") JUST_ARCH="aarch64" ;; \
70+
*) JUST_ARCH="x86_64" ;; \
71+
esac && \
72+
curl -L https://github.com/casey/just/releases/download/$(yq '.tools.just' mise.toml)/just-$(yq '.tools.just' mise.toml)-$JUST_ARCH-unknown-linux-musl.tar.gz | \
6873
tar xz -C /usr/local/bin just
6974
# Go sources
7075
COPY ./go.mod /app/go.mod
@@ -105,6 +110,7 @@ RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache
105110
GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE VERSION="$OP_PROPOSER_VERSION"
106111

107112
FROM golang:1.24-alpine AS deployment-utils-builder
113+
ENV GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE
108114
RUN apk add gcc lld musl-dev # For CGO
109115
RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build go install -ldflags '-linkmode external -extldflags "-static"' github.com/tomwright/dasel/v2/cmd/[email protected]
110116
RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build go install -ldflags '-linkmode external -extldflags "-static"' github.com/mikefarah/yq/[email protected]

0 commit comments

Comments
 (0)