Skip to content

Commit

Permalink
ci: add juno image build
Browse files Browse the repository at this point in the history
  • Loading branch information
xJonathanLEI committed Dec 16, 2023
1 parent 0efff5f commit 294d838
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 0 deletions.
107 changes: 107 additions & 0 deletions .github/workflows/docker-juno.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: "Build Docker images with juno"

on:
workflow_dispatch:
inputs:
firestarkVersion:
description: "firestark version"
required: true
junoVersion:
description: "juno version"
required: true

jobs:
image-info:
name: "Extract image info"
runs-on: "ubuntu-latest"
outputs:
tag: ${{ steps.derive.outputs.tag }}

env:
DOCKER_REPOSITORY: "starknet/firestark"

steps:
- id: "derive"
name: "Derive image info from workflow input"
run: |
echo "tag=${DOCKER_REPOSITORY}:${{ github.event.inputs.firestarkVersion }}-juno-${{ github.event.inputs.junoVersion }}" >> $GITHUB_OUTPUT
build:
name: "Build for ${{ matrix.platform }}"
runs-on: "ubuntu-latest"
needs:
- "image-info"

strategy:
matrix:
include:
- tag: "amd64"
platform: "linux/amd64"
artifact: "amd64.tar.gz"
- tag: "arm64"
platform: "linux/arm64/v8"
artifact: "arm64.tar.gz"

steps:
- name: "Checkout"
uses: "actions/checkout@v3"

- name: "Build Docker image"
run: |
docker buildx build \
-t ${{ needs.image-info.outputs.tag }}-${{ matrix.tag }} \
--build-arg FIRESTARK_VERSION=${{ github.event.inputs.firestarkVersion }} \
--build-arg JUNO_VERSION=${{ github.event.inputs.junoVersion }} \
--platform "${{ matrix.platform }}" \
--output=type=docker \
-f ./Dockerfile.juno .
- name: "Export Docker image"
run: |
docker save ${{ needs.image-info.outputs.tag }}-${{ matrix.tag }} | gzip > /tmp/${{ matrix.artifact }}
- name: "Upload Docker image artifact"
uses: "actions/upload-artifact@v3"
with:
name: "${{ matrix.artifact }}"
path: "/tmp/${{ matrix.artifact }}"

push:
name: "Push Docker images"
runs-on: "ubuntu-latest"
needs:
- "image-info"
- "build"

steps:
- name: "Download linux/amd64 image"
uses: "actions/download-artifact@v3"
with:
name: "amd64.tar.gz"
path: "/tmp/"

- name: "Download linux/arm64/v8 image"
uses: "actions/download-artifact@v3"
with:
name: "arm64.tar.gz"
path: "/tmp/"

- name: "Load Docker images"
run: |
docker load < /tmp/amd64.tar.gz
docker load < /tmp/arm64.tar.gz
- name: "Login to Docker Hub"
uses: "docker/[email protected]"
with:
username: "${{ secrets.DOCKER_HUB_USERNAME }}"
password: "${{ secrets.DOCKER_HUB_PASSWORD }}"

- name: "Push Docker images"
run: |
docker push ${{ needs.image-info.outputs.tag }}-amd64
docker push ${{ needs.image-info.outputs.tag }}-arm64
docker manifest create ${{ needs.image-info.outputs.tag }} \
${{ needs.image-info.outputs.tag }}-amd64 \
${{ needs.image-info.outputs.tag }}-arm64
docker manifest push ${{ needs.image-info.outputs.tag }}
10 changes: 10 additions & 0 deletions Dockerfile.juno
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ARG FIRESTARK_VERSION
ARG JUNO_VERSION

FROM starknet/firestark:${FIRESTARK_VERSION} AS firestark

FROM starknet/juno-firehose:${JUNO_VERSION}

COPY --from=firestark /usr/bin/firestark /usr/bin/firestark

ENTRYPOINT ["firestark"]
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ These images are pure `firestark` images with no StarkNet client bundled. These

These images are `firestark` images bundled with [instrumented pathfinder](https://github.com/starknet-graph/pathfinder) builds. They work as an out-of-the-box solution that you can use to quickly spin up a working cluster.

### starknet/firestark:${FIRESTARK_VERSION}-juno-${PATHFINDER_VERSION}

These images are `firestark` images bundled with [instrumented juno](https://github.com/starknet-graph/juno) builds. They work as an out-of-the-box solution that you can use to quickly spin up a working cluster.

### starknet/firestark:${FIRESTARK_VERSION}-jsonrpc-${JSONRPC_TO_FIRESTARK_VERSION}

Similar to the `pathfinder` variant but these images come with [jsonrpc-to-firestark](https://github.com/starknet-graph/jsonrpc-to-firestark) bundled instead. [jsonrpc-to-firestark](https://github.com/starknet-graph/jsonrpc-to-firestark) is useful when you have an already-syned Starknet node, as it's much faster than syncing an instrumented node from scratch.
Expand Down

0 comments on commit 294d838

Please sign in to comment.