Skip to content

Commit

Permalink
Update Docker image build pipelines (celestiaorg#1337)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbowen93 authored Nov 15, 2022
1 parent 0a4013c commit 0d74d45
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ name: "docker-build"

on:
push:
branches:
- "**"
workflow_dispatch:

env:
GO_VERSION: 1.19
IMAGE_NAME: ${{ github.repository }}
REGISTRY: ghcr.io

Expand All @@ -21,40 +18,41 @@ jobs:
permissions:
contents: write
packages: write

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

- name: set up go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha
type=semver,pattern={{major}}.{{minor}}.{{patch}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=semver,pattern={{version}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
- name: Build and Push amd64 Image
if: |
github.ref != 'refs/heads/main' &&
!startsWith(github.ref, 'refs/tags/v')
uses: docker/build-push-action@v3
with:
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
file: docker/Dockerfile
- name: Build and Push amd64+arm64 Images
if: |
github.ref == 'refs/heads/main' ||
startsWith(github.ref, 'refs/tags/v')
uses: docker/build-push-action@v3
with:
platforms: linux/amd64, linux/arm64
platforms: linux/arm64, linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
file: docker/Dockerfile

0 comments on commit 0d74d45

Please sign in to comment.