Skip to content
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/famous-swans-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cartesi/sdk": patch
---

add rollups-database and rollups-runtime container image releases
52 changes: 43 additions & 9 deletions .github/workflows/sdk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ permissions:
id-token: write
actions: write
jobs:
build:
meta:
runs-on: ubuntu-latest
strategy:
matrix:
target:
- rollups-database
- rollups-runtime
- sdk
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand All @@ -35,15 +41,31 @@ jobs:
id: meta
uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5.7.0
with:
bake-target: docker-metadata-${{ matrix.target }}
images: |
docker.io/cartesi/sdk,enable=${{ github.event_name != 'pull_request' }}
ghcr.io/cartesi/sdk
docker.io/cartesi/${{ matrix.target }},enable=${{ github.event_name != 'pull_request' }}
ghcr.io/cartesi/${{ matrix.target }}
tags: |
type=raw,value=${{ steps.package-version.outputs.PACKAGE_VERSION }},enable=${{ github.event_name == 'push' }}
type=ref,event=pr
labels: |
org.opencontainers.image.title=Cartesi SDK
org.opencontainers.image.description=Cartesi SDK tools image

- name: Upload bake definition file
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: docker-metadata-${{ matrix.target }}
path: ${{ steps.meta.outputs.bake-file }}

build:
runs-on: ubuntu-latest
needs: meta
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Download all docker-metadata artifacts
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
with:
path: packages/sdk/

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
Expand All @@ -66,10 +88,16 @@ jobs:
if: ${{ !startsWith(github.ref, 'refs/tags/sdk@') }}
with:
workdir: packages/sdk
targets: |
rollups-database
rollups-runtime
sdk
files: |
./docker-bake.hcl
./docker-bake.platforms.hcl
${{ steps.meta.outputs.bake-file }}
./docker-metadata-sdk/docker-metadata-action-bake.json
./docker-metadata-rollups-runtime/docker-metadata-action-bake.json
./docker-metadata-rollups-database/docker-metadata-action-bake.json
set: |
*.cache-from=type=gha
*.cache-to=type=gha,mode=max
Expand All @@ -82,8 +110,14 @@ jobs:
with:
project: ${{ vars.DEPOT_PROJECT }}
workdir: packages/sdk
targets: |
rollups-database
rollups-runtime
sdk
files: |
./docker-bake.hcl
./docker-bake.platforms.hcl
${{ steps.meta.outputs.bake-file }}
./docker-bake.platforms.json
./docker-metadata-sdk/docker-metadata-action-bake.json
./docker-metadata-rollups-runtime/docker-metadata-action-bake.json
./docker-metadata-rollups-database/docker-metadata-action-bake.json
push: true
12 changes: 6 additions & 6 deletions packages/sdk/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

################################################################################
# https://github.com/EspressoSystems/espresso-sequencer/pkgs/container/espresso-sequencer%2Fespresso-dev-node
FROM ${ESPRESSO_DEV_NODE_BASE_IMAGE} AS espresso-dev-node

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 ${ESPRESSO_DEV_NODE_BASE_IMAGE} results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/

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

Check warning on line 12 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 @@ -121,8 +121,8 @@
EOF

################################################################################
# cartesi runtime target
FROM base AS runtime
# cartesi rollups-runtime target
FROM base AS rollups-runtime
ARG CARTESI_MACHINE_EMULATOR_VERSION
ARG CARTESI_ROLLUPS_NODE_VERSION
ARG TARGETARCH
Expand Down Expand Up @@ -178,7 +178,7 @@

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

Check warning on line 181 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 @@ -188,13 +188,13 @@
libslirp0
EOF

COPY --from=runtime /usr/bin/cartesi-rollups-cli /usr/bin/
COPY --from=runtime /usr/lib/libcartesi* /usr/lib/
COPY --from=rollups-runtime /usr/bin/cartesi-rollups-cli /usr/bin/
COPY --from=rollups-runtime /usr/lib/libcartesi* /usr/lib/
COPY --from=go-migrate /usr/local/bin/migrate /usr/local/bin/
COPY --from=graphql-migration /usr/share/cartesi/rollups-graphql/migrations /usr/share/cartesi/rollups-graphql/migrations
COPY --from=espresso-reader-migration /usr/share/cartesi/rollups-espresso-reader/migrations /usr/share/cartesi/rollups-espresso-reader/migrations

ARG POSTGRES_PASSWORD=password

Check warning on line 197 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, graphql and espresso databases
COPY <<EOF /docker-entrypoint-initdb.d/00-createdb.sql
Expand Down Expand Up @@ -229,12 +229,12 @@

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

Check warning on line 232 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

################################################################################
# sdk final image
FROM runtime
FROM rollups-runtime
ARG ALTO_VERSION
ARG CARTESI_DEVNET_VERSION
ARG CARTESI_IMAGE_KERNEL_VERSION
Expand Down
32 changes: 30 additions & 2 deletions packages/sdk/docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
target "docker-metadata-action" {}
target "docker-metadata-sdk" {}
target "docker-metadata-rollups-runtime" {}
target "docker-metadata-rollups-database" {}
target "docker-platforms" {}

target "default" {
inherits = ["docker-metadata-action", "docker-platforms"]
inherits = ["docker-platforms"]
args = {
ALTO_VERSION = "0.0.4"
CARTESI_BASE_IMAGE = "docker.io/library/debian:bookworm-20250317-slim@sha256:1209d8fd77def86ceb6663deef7956481cc6c14a25e1e64daec12c0ceffcc19d"
Expand All @@ -23,3 +25,29 @@ target "default" {
XGENEXT2_VERSION = "1.5.6"
}
}

target "sdk" {
inherits = ["default", "docker-metadata-sdk"]
labels = {
"org.opencontainers.image.title" = "Cartesi SDK Image"
"org.opencontainers.image.description" = "Cartesi SDK tools image"
}
}

target "rollups-runtime" {
inherits = ["default", "docker-metadata-rollups-runtime"]
target = "rollups-runtime"
labels = {
"org.opencontainers.image.title" = "Cartesi Rollups Runtime image"
"org.opencontainers.image.description" = "Cartesi Rollups Runtime for production usage"
}
}

target "rollups-database" {
inherits = ["default", "docker-metadata-rollups-database"]
target = "rollups-database"
labels = {
"org.opencontainers.image.title" = "Cartesi SDK Rollups Database image"
"org.opencontainers.image.description" = "Cartesi SDK PostgreSQL Database with preinitialized database for local development"
}
}
10 changes: 9 additions & 1 deletion packages/sdk/docker-bake.override.hcl
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
target "default" {
target "sdk" {
tags = ["cartesi/sdk:devel"]
}

target "rollups-runtime" {
tags = ["cartesi/rollups-runtime:devel"]
}

target "rollups-database" {
tags = ["cartesi/rollups-database:devel"]
}
Loading