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

Create single docker image for rollups node #85

Merged
merged 6 commits into from
Sep 14, 2023
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
92 changes: 21 additions & 71 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Build
name: Build and test

on:
pull_request:
push:
tags:
- v*
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
packages: write
id-token: write
contents: read

jobs:
test:
runs-on: ubuntu-22.04
env:
CARGO_REGISTRIES_CARTESI_INDEX: https://github.com/cartesi/crates-index
RUSTFLAGS: -D warnings -C debuginfo=0
defaults:
run:
Expand Down Expand Up @@ -78,9 +81,20 @@ jobs:
id: docker_meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}
images: |
name=ghcr.io/cartesi/rollups-node
name=docker.io/cartesi/rollups-node,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
tags: |
type=sha,format=long
type=semver,pattern={{version}}
type=ref,event=branch
type=ref,event=pr

- name: Login to Docker Hub
uses: docker/login-action@v2
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
Expand All @@ -90,79 +104,15 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- uses: depot/setup-action@v1
- name: Build docker images
- name: Build and push docker image
id: docker_build
uses: depot/bake-action@v1
with:
files: |
./docker-bake.hcl
${{ steps.docker_meta.outputs.bake-file }}
./docker-bake.platforms.hcl
targets: deps
targets: rollups-node
push: true
project: ${{ vars.DEPOT_PROJECT }}

- uses: snok/container-retention-policy@v1
with:
image-names: rollups
cut-off: one second ago UTC
timestamp-to-use: updated_at
account-type: org
org-name: ${{ github.repository_owner }}
token: ${{ secrets.GHCR_TOKEN }}

dispatcher:
needs: build_docker
uses: ./.github/workflows/docker.yml
with:
target: dispatcher
image-name: rollups-dispatcher
secrets: inherit

state_server:
needs: build_docker
uses: ./.github/workflows/docker.yml
with:
target: state-server
image-name: rollups-state-server
secrets: inherit

graphql_server:
needs: build_docker
uses: ./.github/workflows/docker.yml
with:
target: graphql-server
image-name: rollups-graphql-server
secrets: inherit

indexer:
needs: build_docker
uses: ./.github/workflows/docker.yml
with:
target: indexer
image-name: rollups-indexer
secrets: inherit

inspect_server:
needs: build_docker
uses: ./.github/workflows/docker.yml
with:
target: inspect-server
image-name: rollups-inspect-server
secrets: inherit

advance_runner:
needs: build_docker
uses: ./.github/workflows/docker.yml
with:
target: advance-runner
image-name: rollups-advance-runner
secrets: inherit

host_runner:
needs: build_docker
uses: ./.github/workflows/docker.yml
with:
target: host-runner
image-name: rollups-host-runner
secrets: inherit
workdir: build
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Check Changelog

on:
Expand All @@ -9,10 +10,7 @@ on:
jobs:
check-changelog:
runs-on: ubuntu-22.04

steps:
- uses: tarides/changelog-check-action@v2
with:
changelog: CHANGELOG.md


Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: Remove docker images for stale/closed PR(s).
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Clean-up Docker images

on:
pull_request:
branches:
- main
types: [closed]

jobs:
cleanup:
name: Cleanup ghcr.io/cartesi/${{ matrix.image }}:pr-${{ github.event.number }} image
Expand All @@ -13,13 +16,7 @@ jobs:
strategy:
matrix:
image:
- rollups-advance-runner
- rollups-dispatcher
- rollups-graphql-server
- rollups-host-runner
- rollups-indexer
- rollups-inspect-server
- rollups-state-server
- rollups-node
steps:
- uses: vlaurin/[email protected]
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/commits.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Conventional commit check

on: [push]

jobs:
commit_messages:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -21,5 +22,4 @@ jobs:
uses: leafo/gh-actions-lua@v10

- name: Check scopes
run: |
lua .github/.check_scopes.lua
run: lua .github/.check_scopes.lua
68 changes: 0 additions & 68 deletions .github/workflows/docker.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Offchain code quality assessment
name: Assess Rust code quality

on:
push:
paths:
- '.github/workflows/code-quality.yml'
- 'offchain/**'

jobs:
assess-offchain-code-quality:
assess-rust-code-quality:
runs-on: ubuntu-latest
env:
CARGO_REGISTRIES_CARTESI_INDEX: https://github.com/cartesi/crates-index
defaults:
run:
working-directory: offchain
Expand Down Expand Up @@ -42,7 +42,6 @@ jobs:

- name: Analyze dependencies
run: cargo machete .
continue-on-error: true

- name: Check code format
run: cargo fmt --all -- --check
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "grpc-interfaces"]
path = grpc-interfaces
path = offchain/grpc-interfaces/grpc-interfaces
url = ../grpc-interfaces.git
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added authority claimer service to support reader mode
- Added support to `POST` *inspect state* requests
- Added snapshot validation. The node will now check whether the snapshot's template hash matches the one stored in the blockchain
- Added `cartesi/rollups-node` docker image with all node binaries

### Changed

Expand All @@ -21,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Removed configurable inspect-server path prefix
- Remove on-chain code from the node repository
- Removed `advance-runner`, `dispatcher`, `graphql-server`, `host-runner`, `inspect-server`, `indexer`, and `state-server` docker images

## [1.0.2] 2023-09-12

Expand Down
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,9 @@ Before building and running any of the inner projects, you should download the s
git submodule update --init --recursive
```

### Building the Docker images
### Building the Docker image

To build the Rollups Docker images, run the following command.

```
docker buildx bake --load
```
To more information on how to build the rollups-node docker image, see the [build directory](./build/README.md).

### Rust

Expand Down
Loading