diff --git a/cpp-low-level/Dockerfile b/cpp-low-level/Dockerfile index b590fab..5a0bf04 100644 --- a/cpp-low-level/Dockerfile +++ b/cpp-low-level/Dockerfile @@ -1,18 +1,35 @@ # syntax=docker.io/docker/dockerfile:1 -FROM --platform=linux/riscv64 ubuntu:22.04 AS builder + +# This enforces that the packages downloaded from the repositories are the same +# for the defined date, no matter when the image is built. +ARG UBUNTU_TAG=noble-20241009 +ARG APT_UPDATE_SNAPSHOT=20241010T030400Z + +################################################################################ +# riscv64 base stage +FROM --platform=linux/riscv64 ubuntu:${UBUNTU_TAG} AS base + +ARG APT_UPDATE_SNAPSHOT +ARG DEBIAN_FRONTEND=noninteractive +RUN <&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \ - esac; \ - url="https://static.rust-lang.org/rustup/archive/1.26.0/${rustArch}/rustup-init"; \ - wget "$url"; \ - echo "${rustupSha256} *rustup-init" | sha256sum -c -; \ - chmod +x rustup-init; \ - ./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \ - rm rustup-init; \ - chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \ - rustup --version; \ - cargo --version; \ - rustc --version; +RUN <&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; +esac +url="https://static.rust-lang.org/rustup/archive/1.27.1/${rustArch}/rustup-init" +curl -fsSL -O "$url" +echo "${rustupSha256} *rustup-init" | sha256sum -c - +chmod +x rustup-init +./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch} +rm rustup-init +chmod -R a+w $RUSTUP_HOME $CARGO_HOME +rustup --version +cargo --version +rustc --version +EOF RUN rustup target add riscv64gc-unknown-linux-gnu @@ -43,7 +76,9 @@ WORKDIR /opt/cartesi/dapp COPY . . RUN cargo build --release -FROM --platform=linux/riscv64 ubuntu:22.04 +################################################################################ +# runtime stage: produces final image that will be executed +FROM base-riscv64 ARG MACHINE_EMULATOR_TOOLS_VERSION=0.14.1 ADD https://github.com/cartesi/machine-emulator-tools/releases/download/v${MACHINE_EMULATOR_TOOLS_VERSION}/machine-emulator-tools-v${MACHINE_EMULATOR_TOOLS_VERSION}.deb / @@ -56,9 +91,8 @@ LABEL io.cartesi.rollups.ram_size=128Mi ARG DEBIAN_FRONTEND=noninteractive RUN <