Skip to content

Commit

Permalink
feat: add ci job to push docker image (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
lesterli authored Oct 11, 2024
1 parent 1bc2e10 commit 7914128
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 2 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: docker_publish

on:
pull_request:
branches:
- 'feat/babylon-rfc'
push:
tags:
- 'v*'

jobs:
docker_pipeline:
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4

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

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Get the version
id: get_version
run: |
if [[ $GITHUB_REF == refs/pull/* ]]; then
echo "VERSION=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
elif [[ $GITHUB_REF == refs/tags/* ]]; then
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
fi
- name: Build and push to Docker Hub
id: build-dockerhub
uses: docker/build-push-action@v6
with:
push: true
file: ./ops/docker/op-stack-go/Dockerfile
target: op-node-target
outputs: type=image,name=${{ vars.DOCKERHUB_REGISTRY_ID }}/op-node-babylon-finality-gadget:${{ steps.get_version.outputs.VERSION }}

4 changes: 2 additions & 2 deletions ops/docker/op-stack-go/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

# All target images use this as base image, and add the final build results.
# It will default to the target platform.
ARG TARGET_BASE_IMAGE=alpine:3.18
ARG TARGET_BASE_IMAGE=alpine:3.20

# We may be cross-building for another platform. Specify which platform we need as builder.
FROM --platform=$BUILDPLATFORM golang:1.21.3-alpine3.18 AS builder
FROM --platform=$BUILDPLATFORM golang:1.22.8-alpine3.20 AS builder

RUN apk add --no-cache make gcc musl-dev linux-headers git jq bash

Expand Down

0 comments on commit 7914128

Please sign in to comment.