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

feat: bump to ubuntu:24.04 #10

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
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
36 changes: 27 additions & 9 deletions cpp-low-level/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 <<EOF
set -eu
apt update
apt install -y --no-install-recommends ca-certificates curl
apt update --snapshot=${APT_UPDATE_SNAPSHOT}
EOF

################################################################################
# riscv64 builder stage
FROM base AS builder

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 \
libtool \
wget
libtool
rm -rf /var/lib/apt/lists/*
EOF

Expand All @@ -21,7 +38,9 @@ WORKDIR /opt/cartesi/dapp
COPY . .
RUN make

FROM --platform=linux/riscv64 ubuntu:22.04
################################################################################
# runtime stage: produces final image that will be executed
FROM base

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 /
Expand All @@ -34,9 +53,8 @@ LABEL io.cartesi.rollups.ram_size=128Mi
ARG DEBIAN_FRONTEND=noninteractive
RUN <<EOF
set -e
apt-get update
apt-get install -y --no-install-recommends \
busybox-static=1:1.30.1-7ubuntu3
busybox-static
rm -rf /var/lib/apt/lists/* /var/log/* /var/cache/*
useradd --create-home --user-group dapp
EOF
Expand Down
2 changes: 1 addition & 1 deletion cpp-low-level/dapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static int open_rollup_device()
return fd;
}

static std::string get_ioctl_name(int request)
static std::string get_ioctl_name(long int request)
{
switch (request)
{
Expand Down
4 changes: 2 additions & 2 deletions cpp/3rdparty/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
all: cpp-httplib picojson

cpp-httplib:
wget https://github.com/yhirose/cpp-httplib/archive/refs/tags/v0.10.4.tar.gz && \
curl -fsSL -O https://github.com/yhirose/cpp-httplib/archive/refs/tags/v0.10.4.tar.gz && \
tar xvf v0.10.4.tar.gz && \
rm v0.10.4.tar.gz && \
mv cpp-httplib-0.10.4 cpp-httplib

picojson:
wget https://github.com/kazuho/picojson/archive/refs/tags/v1.3.0.tar.gz && \
curl -fsSL -O https://github.com/kazuho/picojson/archive/refs/tags/v1.3.0.tar.gz && \
tar xvf v1.3.0.tar.gz && \
rm v1.3.0.tar.gz && \
mv picojson-1.3.0 picojson
Expand Down
36 changes: 27 additions & 9 deletions cpp/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,45 @@
# 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 <<EOF
set -eu
apt update
apt install -y --no-install-recommends ca-certificates curl
apt update --snapshot=${APT_UPDATE_SNAPSHOT}
EOF

################################################################################
# riscv64 builder stage
FROM base AS builder

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 \
libtool \
wget
libtool
rm -rf /var/lib/apt/lists/*
EOF

WORKDIR /opt/cartesi/dapp
COPY . .
RUN make

FROM --platform=linux/riscv64 ubuntu:22.04
################################################################################
# runtime stage: produces final image that will be executed
FROM base

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 /
Expand All @@ -33,9 +52,8 @@ LABEL io.cartesi.rollups.ram_size=128Mi
ARG DEBIAN_FRONTEND=noninteractive
RUN <<EOF
set -e
apt-get update
apt-get install -y --no-install-recommends \
busybox-static=1:1.30.1-7ubuntu3
busybox-static
rm -rf /var/lib/apt/lists/* /var/log/* /var/cache/*
useradd --create-home --user-group dapp
EOF
Expand Down
56 changes: 44 additions & 12 deletions go/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,55 @@
# syntax=docker.io/docker/dockerfile:1
FROM ubuntu:22.04 AS build-stage

# 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-riscv64

ARG APT_UPDATE_SNAPSHOT
ARG DEBIAN_FRONTEND=noninteractive
RUN <<EOF
set -e
set -eu
apt update
apt install -y --no-install-recommends ca-certificates curl
apt update --snapshot=${APT_UPDATE_SNAPSHOT}
EOF

################################################################################
# cross base stage
FROM --platform=$BUILDPLATFORM ubuntu:${UBUNTU_TAG} AS base-cross

ARG APT_UPDATE_SNAPSHOT
ARG DEBIAN_FRONTEND=noninteractive
RUN <<EOF
set -eu
apt update
apt install -y --no-install-recommends ca-certificates curl
apt update --snapshot=${APT_UPDATE_SNAPSHOT}
EOF

################################################################################
# cross build stage
FROM base-cross AS cross-build-stage

ARG DEBIAN_FRONTEND=noninteractive
RUN <<EOF
set -e
apt install -y --no-install-recommends \
build-essential=12.9ubuntu3 \
build-essential \
ca-certificates \
g++-riscv64-linux-gnu=4:11.2.0--1ubuntu1 \
wget
g++-riscv64-linux-gnu
EOF

ARG GOVERSION=1.20.5
ARG GOVERSION=1.23.2

WORKDIR /opt/build

RUN wget https://go.dev/dl/go${GOVERSION}.linux-$(dpkg --print-architecture).tar.gz && \
tar -C /usr/local -xzf go${GOVERSION}.linux-$(dpkg --print-architecture).tar.gz
RUN curl -fsSL https://go.dev/dl/go${GOVERSION}.linux-$(dpkg --print-architecture).tar.gz | \
tar -C /usr/local -xzf -

ENV GOOS=linux
ENV GOARCH=riscv64
Expand All @@ -29,8 +61,9 @@ COPY src .

RUN make

################################################################################
# runtime stage: produces final image that will be executed
FROM --platform=linux/riscv64 ubuntu:22.04
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 /
Expand All @@ -43,17 +76,16 @@ LABEL io.cartesi.rollups.ram_size=128Mi
ARG DEBIAN_FRONTEND=noninteractive
RUN <<EOF
set -e
apt-get update
apt-get install -y --no-install-recommends \
busybox-static=1:1.30.1-7ubuntu3
busybox-static
rm -rf /var/lib/apt/lists/* /var/log/* /var/cache/*
useradd --create-home --user-group dapp
EOF

ENV PATH="/opt/cartesi/bin:${PATH}"

WORKDIR /opt/cartesi/dapp
COPY --from=build-stage /opt/build/dapp .
COPY --from=cross-build-stage /opt/build/dapp .

ENV ROLLUP_HTTP_SERVER_URL="http://127.0.0.1:5004"

Expand Down
Loading