Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump machine-emulator to 0.18.1 #82

Merged
merged 7 commits into from
Oct 10, 2024
Merged
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
5 changes: 5 additions & 0 deletions .changeset/popular-goats-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cartesi/sdk": minor
---

bump machine-emulator to 0.18.1
106 changes: 65 additions & 41 deletions packages/sdk/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,67 +1,80 @@
# syntax=docker.io/docker/dockerfile:1
ARG BASE_IMAGE
ARG SERVER_MANAGER_REGISTRY
ARG SERVER_MANAGER_ORG
ARG SERVER_MANAGER_VERSION
ARG CARTESI_MACHINE_EMULATOR_VERSION
ARG CARTESI_IMAGE_KERNEL_VERSION
ARG LINUX_KERNEL_VERSION
ARG XGENEXT2_VERSION
ARG CRANE_VERSION
ARG NODEJS_VERSION
ARG SU_EXEC_VERSION
ARG ANVIL_VERSION

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

Check warning on line 14 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 ${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
apt-get update
apt-get install -y --no-install-recommends \
ca-certificates \
curl
EOF

FROM ${BASE_IMAGE} AS builder

################################################################################
# builder image
FROM base AS builder
WORKDIR /usr/local/src
ARG DEBIAN_FRONTEND=noninteractive
RUN <<EOF
set -e
apt-get update
apt-get install -y --no-install-recommends \
autoconf \
automake \
build-essential \
ca-certificates \
curl \
libarchive-dev \
libtool
rm -rf /var/lib/apt/lists/*
EOF

################################################################################
# su-exec builder
FROM builder AS su-exec

# v0.2 -> f85e5bde1afef399021fbc2a99c837cf851ceafa
ARG SU_EXEC_VERSION
WORKDIR /usr/local/src
ADD https://github.com/ncopa/su-exec.git#f85e5bde1afef399021fbc2a99c837cf851ceafa /usr/local/src
ADD https://github.com/ncopa/su-exec.git#v${SU_EXEC_VERSION} /usr/local/src
RUN make

FROM builder AS crane
ARG CRANE_VERSION=0.19.1
################################################################################
# crane installer
FROM base AS crane
ARG CRANE_VERSION
RUN <<EOF
set -e

#FIXME: ugly hack to download the right go-containerregistry binary
case "$(arch)" in
aarch64) ARCH="arm64" ;;
*) ARCH=$(arch) ;;
esac

curl -sSL https://github.com/google/go-containerregistry/releases/download/v${CRANE_VERSION}/go-containerregistry_Linux_${ARCH}.tar.gz | \
curl -fsSL https://github.com/google/go-containerregistry/releases/download/v${CRANE_VERSION}/go-containerregistry_Linux_${ARCH}.tar.gz | \
tar -zx -C /usr/local/bin
EOF

# alto
FROM node:18.19.0-bookworm AS alto
################################################################################
# alto installer
FROM node:${NODEJS_VERSION}-bookworm AS alto

Check warning on line 64 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 node:${NODEJS_VERSION}-bookworm results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/
ARG ALTO_VERSION
RUN npm install -g @pimlico/alto@${ALTO_VERSION}

# devnet files
FROM node:slim AS devnet
################################################################################
# devnet installer
FROM node:${NODEJS_VERSION}-bookworm AS devnet

Check warning on line 70 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 node:${NODEJS_VERSION}-bookworm results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/
ARG DEVNET_VERSION
RUN npm install -g @cartesi/devnet@${DEVNET_VERSION}

# sdk image
FROM $SERVER_MANAGER_REGISTRY/$SERVER_MANAGER_ORG/server-manager:$SERVER_MANAGER_VERSION
ARG SERVER_MANAGER_REGISTRY
ARG SERVER_MANAGER_ORG
ARG SERVER_MANAGER_VERSION
################################################################################
# sdk final image
FROM base
ARG CARTESI_MACHINE_EMULATOR_VERSION
ARG CARTESI_IMAGE_KERNEL_VERSION
ARG LINUX_KERNEL_VERSION
ARG XGENEXT2_VERSION
Expand All @@ -70,20 +83,21 @@
USER root
ARG DEBIAN_FRONTEND=noninteractive
RUN <<EOF
set -e
echo 'deb http://deb.debian.org/debian bookworm-backports main' > /etc/apt/sources.list.d/backports.list
apt-get update
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
jq \
libarchive-tools \
libslirp0 \
locales \
lua5.4 \
nodejs \
npm \
squashfs-tools \
xxd \
xz-utils

# Install e2fsprogs from backports
echo 'deb http://deb.debian.org/debian bookworm-backports main' > /etc/apt/sources.list.d/backports.list
apt-get update
apt-get install -y --no-install-recommends -t bookworm-backports \
e2fsprogs
rm -rf /var/lib/apt/lists/*
Expand All @@ -96,24 +110,22 @@
# Install dpkg release of xgenext2fs
RUN <<EOF
ARCH=$(dpkg --print-architecture)
curl -sSL https://github.com/cartesi/genext2fs/releases/download/v${XGENEXT2_VERSION}/xgenext2fs_${ARCH}.deb \
-o ./xgenext2fs.deb
dpkg -i ./xgenext2fs.deb
rm ./xgenext2fs.deb
curl -fsSL https://github.com/cartesi/genext2fs/releases/download/v${XGENEXT2_VERSION}/xgenext2fs_${ARCH}.deb \
-o /tmp/xgenext2fs.deb
dpkg -i /tmp/xgenext2fs.deb
rm /tmp/xgenext2fs.deb
xgenext2fs --version
EOF

# Install mock-verifying-paymaster
RUN <<EOF
npm install -g @cartesi/mock-verifying-paymaster@${PAYMASTER_VERSION}
EOF
RUN npm install -g @cartesi/mock-verifying-paymaster@${PAYMASTER_VERSION}

ENV LC_ALL=en_US.UTF-8
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en

# download anvil pre-compiled binaries
ARG ANVIL_VERSION=e90348416c3a831ab75bb43f6fa5f0a0be4106c4
ARG ANVIL_VERSION
RUN curl -sSL https://github.com/foundry-rs/foundry/releases/download/nightly-${ANVIL_VERSION}/foundry_nightly_linux_$(dpkg --print-architecture).tar.gz | \
tar -zx -C /usr/local/bin

Expand All @@ -133,13 +145,25 @@
COPY --from=devnet /usr/local/lib/node_modules/@cartesi/devnet/build/anvil_state.json /usr/share/cartesi/
RUN mkdir -p /tmp/.cartesi && chmod 1777 /tmp/.cartesi

# Install cartesi-machine emulator
RUN <<EOF
ARCH=$(dpkg --print-architecture)
curl -fsSL https://github.com/cartesi/machine-emulator/releases/download/v${CARTESI_MACHINE_EMULATOR_VERSION}/cartesi-machine-v${CARTESI_MACHINE_EMULATOR_VERSION}_${ARCH}.deb \
-o /tmp/cartesi-machine.deb
dpkg -i /tmp/cartesi-machine.deb
rm /tmp/cartesi-machine.deb
cartesi-machine --version-json
EOF

# Install linux kernel image
ADD --chmod=644 \
--checksum=sha256:1dc36e05bf04d3fff097e51408556cef4d5ac09792e245b37c470d9188a4c173 \
--checksum=sha256:65dd100ff6204346ac2f50f772721358b5c1451450ceb39a154542ee27b4c947 \
https://github.com/cartesi/image-kernel/releases/download/v${CARTESI_IMAGE_KERNEL_VERSION}/linux-${LINUX_KERNEL_VERSION}.bin \
/usr/share/cartesi-machine/images/linux.bin

# Install linux headers
ADD --chmod=644 \
--checksum=sha256:58d1b232e6c2ed735f362ef0454802ae72a39798d472c0253cabec041703a16a \
--checksum=sha256:4a4714bfa8c0028cb443db2036fad4f8da07065c1cb4ac8e0921a259fddd731b \
https://github.com/cartesi/image-kernel/releases/download/v$CARTESI_IMAGE_KERNEL_VERSION/linux-headers-$LINUX_KERNEL_VERSION.tar.xz \
/usr/share/cartesi-machine/images/linux-headers.tar.xz
RUN tar -xJf /usr/share/cartesi-machine/images/linux-headers.tar.xz -C / && \
Expand Down
22 changes: 12 additions & 10 deletions packages/sdk/docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ target "docker-platforms" {}
target "default" {
inherits = ["docker-metadata-action", "docker-platforms"]
args = {
BASE_IMAGE = "debian:bookworm-20240311"
SERVER_MANAGER_REGISTRY = "docker.io"
SERVER_MANAGER_ORG = "cartesi"
SERVER_MANAGER_VERSION = "0.9.1"
CARTESI_IMAGE_KERNEL_VERSION = "0.19.1"
ALTO_VERSION = "0.0.4"
PAYMASTER_VERSION = "0.2.0"
DEVNET_VERSION = "1.8.0"
LINUX_KERNEL_VERSION = "6.5.9-ctsi-1-v0.19.1"
XGENEXT2_VERSION = "1.5.6"
BASE_IMAGE = "debian:bookworm-20240926"
CARTESI_MACHINE_EMULATOR_VERSION = "0.18.1"
CARTESI_IMAGE_KERNEL_VERSION = "0.20.0"
ALTO_VERSION = "0.0.4"
PAYMASTER_VERSION = "0.2.0"
DEVNET_VERSION = "1.8.0"
LINUX_KERNEL_VERSION = "6.5.13-ctsi-1-v0.20.0"
XGENEXT2_VERSION = "1.5.6"
CRANE_VERSION = "0.19.1"
NODEJS_VERSION = "18.19.0"
SU_EXEC_VERSION = "0.2"
ANVIL_VERSION = "e90348416c3a831ab75bb43f6fa5f0a0be4106c4"
}
}
Loading