Skip to content

Commit

Permalink
Update Docker image build pipelines (celestiaorg#990)
Browse files Browse the repository at this point in the history
# PULL REQUEST

<!--
Please read and fill out this form before submitting your PR.

Please make sure you have reviewed our contributors guide before
submitting your
first PR.
-->

## Overview

Updates the Docker image build Github Action Pipelines.

The `amd64-docker-build` job is run on all pushes to all branches. It
creates a `linux/amd64` docker image that is tagged with the short
commit sha.

[Example
Job](https://github.com/jbowen93/celestia-app/actions/runs/3432472621/jobs/5721783469)
w/ [resulting
image](https://github.com/jbowen93/celestia-app/pkgs/container/celestia-app/49690412?tag=sha-9087311)

The `main-docker-build` job runs on pushes to `main` as well as when any
new tags are pushed. It creates both a `linux/arm64` image and a
`linux/amd64` image. When run against `main` the image is tagged with
the short commit sha. When run against a tag the image is tagged with
the git tag.

[Example
Job](https://github.com/jbowen93/celestia-app/actions/runs/3432479009/jobs/5721797340)
w/ [resulting
image](https://github.com/jbowen93/celestia-app/pkgs/container/celestia-app/49692397?tag=sha-ff1c238)

[Example
Job](https://github.com/jbowen93/celestia-app/actions/runs/3432357771)
for a tagged run w/ [resulting
image](https://github.com/jbowen93/celestia-app/pkgs/container/celestia-app/49690070?tag=0.0.91-rc1).
## Checklist

<!-- 
Please complete the checklist to ensure that the PR is ready to be
reviewed.

IMPORTANT:
PRs should be left in Draft until the below checklist is completed.
-->

- [x] New and updated code has appropriate documentation
- [x] New and updated code has new and/or updated testing
- [x] Required CI checks are passing
- [x] Visual proof for any user facing features like CLI or
documentation updates
- [x] Linked issues closed with keywords
  • Loading branch information
jbowen93 authored and rach-id committed Nov 16, 2022
1 parent c14a0c7 commit 96eb84e
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 88 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/amd64-docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: "amd64-docker-build"

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

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

jobs:
docker-build:
runs-on: "ubuntu-latest"
permissions:
contents: write
packages: write
steps:
- uses: "actions/checkout@v3"
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha
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
uses: docker/build-push-action@v3
with:
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
file: Dockerfile
88 changes: 0 additions & 88 deletions .github/workflows/docker-build.yml

This file was deleted.

45 changes: 45 additions & 0 deletions .github/workflows/main-docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: "main-docker-build"

on:
push:
branches:
- main
tags:
- "v*"
workflow_dispatch:

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

jobs:
docker-build:
runs-on: "ubuntu-latest"
permissions:
contents: write
packages: write
steps:
- uses: "actions/checkout@v3"
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha
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
uses: docker/build-push-action@v3
with:
platforms: linux/arm64, linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
file: Dockerfile

0 comments on commit 96eb84e

Please sign in to comment.