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: action to build docker images on push to develop branch #1

Draft
wants to merge 6 commits into
base: develop
Choose a base branch
from
Draft
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
59 changes: 59 additions & 0 deletions .github/workflows/build-and-push-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Build and Push Docker Images

on:
push:
branches: [ "develop" ]
workflow_dispatch: # Allows manual triggering

env:
REGISTRY: registry.digitalocean.com
REPOSITORY: sigil

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# Authenticate with Digital Ocean registry
- name: Log in to DO Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
password: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}

# Build and push each image
- name: Build and push images
uses: docker/bake-action@v4
with:
files: ./docker-bake.hcl
targets: |
op-node
op-batcher
op-proposer
push: true
set: |
*.REGISTRY=${{ env.REGISTRY }}
*.REPOSITORY=${{ env.REPOSITORY }}
*.IMAGE_TAGS=${{ github.sha }},latest
*.PLATFORMS=linux/amd64

- name: Save DigitalOcean kubeconfig
run: doctl kubernetes cluster kubeconfig save ${{ secrets.CLUSTER_NAME }}

- name: Update deployment image
run: |
kubectl set image statefulset/${{ matrix.deployment }} ${{ matrix.component }}=${REGISTRY}/${{ matrix.component }}:${GITHUB_SHA}

- name: Verify deployment
run: |
kubectl rollout status statefulset/${{ matrix.deployment }}
6 changes: 6 additions & 0 deletions ops/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# ops

Various operational packages

## Building op-node

Building the image for `op-node` requires `rollup.json` to be in the project
root. You can read more about how to generate `rollup.json` in the [op-stack
tutorial](https://docs.optimism.io/builders/chain-operators/tutorials/create-l2-rollup#generate-the-l2-config-files).
2 changes: 2 additions & 0 deletions ops/docker/op-stack-go/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ CMD ["op-wheel"]

FROM --platform=$TARGETPLATFORM $TARGET_BASE_IMAGE AS op-node-target
COPY --from=op-node-builder /app/op-node/bin/op-node /usr/local/bin/
# also copy rollup.json into the image
COPY ./rollup.json /rollup.json
CMD ["op-node"]

FROM --platform=$TARGETPLATFORM $TARGET_BASE_IMAGE AS op-challenger-target
Expand Down