-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
A-compatibilityArea: compatibilityArea: compatibilityA-releasesArea: releases/packagingArea: releases/packagingT-featureType: featureType: feature
Milestone
Description
Component
Forge, Cast, Anvil, Chisel
Describe the feature you would like
When attempting to run a Docker image that got build using Alpine, I encounter an error indicating that anvil
is not found. However, using the same configuration with Ubuntu works as expected. Below are the respective Dockerfile configurations for both Alpine and Ubuntu.
Alpine Dockerfile:
FROM alpine:latest AS builder
WORKDIR /app
RUN apk update && apk add --no-cache wget
ARG TARGETARCH
RUN if [ "$TARGETARCH" = "amd64" ]; then \
wget https://github.com/foundry-rs/foundry/releases/download/nightly-62cdea8ff9e6efef011f77e295823b5f2dbeb3a1/foundry_nightly_linux_amd64.tar.gz && \
tar -xzf foundry_nightly_linux_amd64.tar.gz; \
elif [ "$TARGETARCH" = "arm64" ]; then \
wget https://github.com/foundry-rs/foundry/releases/download/nightly-62cdea8ff9e6efef011f77e295823b5f2dbeb3a1/foundry_nightly_linux_arm64.tar.gz && \
tar -xzf foundry_nightly_linux_arm64.tar.gz; \
else \
echo "Unsupported architecture"; exit 1; \
fi
FROM alpine:latest
EXPOSE 8545
WORKDIR /app
RUN apk update && apk add --no-cache curl
COPY --from=builder /app/anvil .
COPY ./cmd.sh .
COPY ./ignition/data/ .
CMD ["./cmd.sh"]
Ubuntu Dockerfile:
FROM ubuntu:latest AS builder
WORKDIR /app
RUN apt-get update && apt-get install -y wget --fix-missing --fix-broken
ARG TARGETARCH
RUN if [ "$TARGETARCH" = "amd64" ]; then \
wget https://github.com/foundry-rs/foundry/releases/download/nightly-62cdea8ff9e6efef011f77e295823b5f2dbeb3a1/foundry_nightly_linux_amd64.tar.gz && \
tar -xzf foundry_nightly_linux_amd64.tar.gz; \
elif [ "$TARGETARCH" = "arm64" ]; then \
wget https://github.com/foundry-rs/foundry/releases/download/nightly-62cdea8ff9e6efef011f77e295823b5f2dbeb3a1/foundry_nightly_linux_arm64.tar.gz && \
tar -xzf foundry_nightly_linux_arm64.tar.gz; \
else \
echo "Unsupported architecture"; exit 1; \
fi
FROM ubuntu:latest
EXPOSE 8545
WORKDIR /app
RUN apt-get update && apt-get install -y curl --fix-missing --fix-broken
COPY --from=builder /app/anvil .
COPY ./cmd.sh .
COPY ./ignition/data/ .
CMD ["./cmd.sh"]
External file cmd.sh
that might be required is:
#!/bin/sh
./anvil --host 0.0.0.0 --block-time 10 &
sleep 3
if [ -n "$CHAIN_ID" ]; then
response=$(curl -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\", \"method\":\"anvil_setChainId\", \"params\":[$CHAIN_ID], \"id\":1}" http://localhost:8545)
echo "Set chain ID response: $response"
else
echo "CHAIN_ID is not set, default chain ID is 31337."
fi
if [ "$LIGHT" = "true" ]; then
state_file="./lightState.json"
else
state_file="./fullState.json"
fi
response=$(curl -s -X POST -H "Content-Type: application/json" --data-binary @$state_file http://localhost:8545)
echo "Set blockchain state response: $response"
tail -f /dev/null
Error Output
cmd.sh: line 3: ./anvil: not found
Expected Behavior
The Alpine Docker image should build and run successfully, similar to the Ubuntu image.
Additional Information
- Alpine Version:
latest
- Ubuntu Version:
latest
- Foundry Release:
nightly-62cdea8ff9e6efef011f77e295823b5f2dbeb3a1
Additional context
No response
Metadata
Metadata
Assignees
Labels
A-compatibilityArea: compatibilityArea: compatibilityA-releasesArea: releases/packagingArea: releases/packagingT-featureType: featureType: feature