Skip to content

Commit

Permalink
ci: add docker build and push to GHCR + Beeper registry, remove upstr…
Browse files Browse the repository at this point in the history
…eam dockerhub build

Signed-off-by: Sumner Evans <[email protected]>
  • Loading branch information
sumnerevans committed Jul 18, 2023
1 parent 0e94bc7 commit 109d927
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 69 deletions.
34 changes: 0 additions & 34 deletions .github/workflows/docker-hub-latest.yml

This file was deleted.

35 changes: 0 additions & 35 deletions .github/workflows/docker-hub-release.yml

This file was deleted.

71 changes: 71 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: GHCR + Beeper Docker Registry

on: [push]

env:
CI_REGISTRY_IMAGE: "${{ secrets.CI_REGISTRY }}/mjolnir"
GHCR_REGISTRY: ghcr.io
GHCR_REGISTRY_IMAGE: "ghcr.io/${{ github.repository }}"

jobs:
build-docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to registry
uses: docker/login-action@v2
with:
registry: ${{ secrets.CI_REGISTRY }}
username: ${{ secrets.CI_REGISTRY_USER }}
password: ${{ secrets.CI_REGISTRY_PASSWORD }}

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

- name: Docker Build
uses: docker/build-push-action@v4
with:
context: .
cache-from: ${{ env.CI_REGISTRY_IMAGE }}:latest
pull: true
file: Dockerfile
tags: |
${{ env.CI_REGISTRY_IMAGE }}:${{ github.sha }}
${{ env.GHCR_REGISTRY_IMAGE }}:${{ github.sha }}
push: true

deploy-docker:
runs-on: ubuntu-latest
needs:
- build-docker
if: github.ref == 'refs/heads/main'
steps:
- name: Login to Beeper Docker registry
uses: docker/login-action@v2
with:
registry: ${{ secrets.CI_REGISTRY }}
username: ${{ secrets.CI_REGISTRY_USER }}
password: ${{ secrets.CI_REGISTRY_PASSWORD }}

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

- uses: beeper/docker-retag-push-latest@main
with:
image: ${{ env.CI_REGISTRY_IMAGE }}

- uses: beeper/docker-retag-push-latest@main
with:
image: ${{ env.GHCR_REGISTRY_IMAGE }}

0 comments on commit 109d927

Please sign in to comment.