Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 18 additions & 27 deletions packages/sdk/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

################################################################################
# base image
FROM ${CARTESI_BASE_IMAGE} AS base

Check warning on line 8 in packages/sdk/Dockerfile

View workflow job for this annotation

GitHub Actions / build

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG ${CARTESI_BASE_IMAGE} results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/
SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
ARG DEBIAN_FRONTEND=noninteractive
RUN <<EOF
Expand Down Expand Up @@ -192,7 +192,7 @@

################################################################################
# postgresql initdb
FROM ${POSTGRES_BASE_IMAGE} AS postgresql-initdb

Check warning on line 195 in packages/sdk/Dockerfile

View workflow job for this annotation

GitHub Actions / build

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG ${POSTGRES_BASE_IMAGE} results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/

ARG DEBIAN_FRONTEND=noninteractive
RUN <<EOF
Expand All @@ -205,7 +205,7 @@
COPY --from=rollups-runtime /usr/bin/cartesi-rollups-cli /usr/bin/
COPY --from=rollups-runtime /usr/lib/libcartesi* /usr/lib/

ARG POSTGRES_PASSWORD=password

Check warning on line 208 in packages/sdk/Dockerfile

View workflow job for this annotation

GitHub Actions / build

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "POSTGRES_PASSWORD") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/

# create rollupsdb databases
COPY <<EOF /docker-entrypoint-initdb.d/00-createdb.sql
Expand All @@ -225,33 +225,29 @@

################################################################################
# rollups-database image
FROM ${POSTGRES_BASE_IMAGE} AS rollups-database

Check warning on line 228 in packages/sdk/Dockerfile

View workflow job for this annotation

GitHub Actions / build

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG ${POSTGRES_BASE_IMAGE} results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/
COPY --from=postgresql-initdb /var/lib/postgresql/data /var/lib/postgresql/data

################################################################################
# alto build
FROM node:${NODE_VERSION} AS alto
ARG ALTO_VERSION
ARG NODE_VERSION
# rundler install
FROM base AS rundler
ARG RUNDLER_VERSION
ARG TARGETARCH
ARG TARGETOS

# install foundry, necessary for building alto
COPY --from=foundry /usr/local/bin/forge /usr/local/bin/forge

WORKDIR /app
COPY alto.patch /app/alto.patch

WORKDIR /usr/local/bin
RUN <<EOF
set -eu
npm install -g pnpm
git clone --branch v${ALTO_VERSION} --depth 1 --recurse-submodules https://github.com/pimlicolabs/alto.git
cd alto
patch -p1 < /app/alto.patch
pnpm install
pnpm run build:contracts
pnpm run build
cd src && pnpm pack # produces pimlico-alto-${ALTO_PACKAGE_VERSION}.tgz
case "${TARGETARCH}" in
amd64)
curl -fsSL https://github.com/alchemyplatform/rundler/releases/download/v${RUNDLER_VERSION}/rundler-v${RUNDLER_VERSION}-x86_64-unknown-${TARGETOS}-gnu.tar.gz \
-o /tmp/rundler.tar.gz
echo "b9d9baf7ee145976aab5c392e3e6de16d6aae2e9126a0b20b10a0acab3d75240 /tmp/rundler.tar.gz" | sha256sum --check ;;
arm64)
curl -fsSL https://github.com/alchemyplatform/rundler/releases/download/v${RUNDLER_VERSION}/rundler-v${RUNDLER_VERSION}-aarch64-unknown-${TARGETOS}-gnu.tar.gz \
-o /tmp/rundler.tar.gz
echo "3c00812dfc10770d3b7e9ca946e8678927664b65a130a4e47c796380471cfb43 /tmp/rundler.tar.gz" | sha256sum --check ;;
*) echo "unsupported architecture: ${TARGETARCH}"; exit 1 ;;
esac
tar -xvzf /tmp/rundler.tar.gz
EOF

################################################################################
Expand All @@ -278,8 +274,6 @@
################################################################################
# sdk final image
FROM rollups-runtime
ARG ALTO_VERSION
ARG ALTO_PACKAGE_VERSION
ARG CARTESI_DEVNET_VERSION
ARG CARTESI_MACHINE_EMULATOR_VERSION
ARG CARTESI_PAYMASTER_VERSION
Expand Down Expand Up @@ -330,15 +324,12 @@
EOF

# Install nodejs packages
COPY --from=alto /app/alto/src/pimlico-alto-${ALTO_PACKAGE_VERSION}.tgz /tmp/pimlico-alto.tgz
RUN <<EOF
npm install -g \
@cartesi/devnet@${CARTESI_DEVNET_VERSION} \
@cartesi/mock-verifying-paymaster@${CARTESI_PAYMASTER_VERSION} \
@cartesi/passkey-server@${CARTESI_PASSKEY_SERVER_VERSION} \
/tmp/pimlico-alto.tgz
@cartesi/passkey-server@${CARTESI_PASSKEY_SERVER_VERSION}

rm /tmp/pimlico-alto.tgz
mkdir -p /usr/share/cartesi
cp -r "$(npm root -g)/@cartesi/devnet/deployments" /usr/share/cartesi/
cp "$(npm root -g)/@cartesi/devnet/anvil_state.json" /usr/share/cartesi/
Expand All @@ -349,7 +340,6 @@
ENV LANGUAGE=en_US:en

# healthcheck script using net_listening JSON-RPC method
COPY alto /usr/local/bin
COPY devnet /usr/local/bin
COPY eth_isready /usr/local/bin

Expand All @@ -359,6 +349,7 @@
COPY --from=squashfs-tools /usr/local/src/squashfs-tools/mksquashfs /usr/local/bin/
COPY --from=kernel-image /usr/share/cartesi-machine/images/linux.bin /usr/share/cartesi-machine/images/linux.bin
COPY --from=kernel-headers /include/linux /include/linux
COPY --from=rundler /usr/local/bin/rundler /usr/local/bin/

WORKDIR /mnt
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
2 changes: 0 additions & 2 deletions packages/sdk/alto

This file was deleted.

28 changes: 0 additions & 28 deletions packages/sdk/alto.patch

This file was deleted.

3 changes: 1 addition & 2 deletions packages/sdk/docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ target "docker-platforms" {}
target "default" {
inherits = ["docker-platforms"]
args = {
ALTO_VERSION = "1.2.5"
ALTO_PACKAGE_VERSION = "0.0.18"
CARTESI_BASE_IMAGE = "docker.io/library/debian:trixie-20260223-slim@sha256:1d3c811171a08a5adaa4a163fbafd96b61b87aa871bbc7aa15431ac275d3d430"
CARTESI_DEVNET_VERSION = "2.0.0-alpha.10"
CARTESI_IMAGE_KERNEL_VERSION = "0.20.0"
Expand All @@ -21,6 +19,7 @@ target "default" {
NODE_VERSION = "24.12.0"
NVM_VERSION = "977563e97ddc66facf3a8e31c6cff01d236f09bd" # 0.40.3
POSTGRES_BASE_IMAGE = "docker.io/library/postgres:17-trixie@sha256:9ba47fa6d1c34e9cc4c1758640e7774a9b73ea0fba891f14088321ba7561d253"
RUNDLER_VERSION = "0.11.0"
SQUASHFS_TOOLS_VERSION = "bad1d213ab6df587d6fa0ef7286180fbf7b86167" # 4.7.4
SU_EXEC_VERSION = "0.3"
TINI_VERSION = "0.19.0"
Expand Down