Skip to content

Commit

Permalink
ci: push Docker images to GHCR and Docker Hub
Browse files Browse the repository at this point in the history
  • Loading branch information
rockbenben committed Sep 14, 2024
1 parent 07a2105 commit 635490f
Showing 1 changed file with 26 additions and 15 deletions.
41 changes: 26 additions & 15 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish Docker image
name: 🐳 Build and Push Docker Image

on:
workflow_dispatch:
Expand All @@ -7,32 +7,43 @@ on:

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
name: Push Docker image to Docker Hub and GHCR
runs-on: ubuntu-latest
steps:
- name: Check out the repo
- name: 🚚 Check out the repo
uses: actions/checkout@v4
- name: Log in to Docker Hub

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

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

- name: 🔐 Login to GitHub Container Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
- name: 🏷️ Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: rockben/chatgpt-shortcut
images: |
${{ vars.DOCKERHUB_USERNAME }}/chatgpt-shortcut
ghcr.io/${{ github.repository_owner }}/chatgpt-shortcut
tags: |
type=raw,value=latest
type=ref,event=tag
type=raw,value=latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

# Build and push Docker image to both Docker Hub and GHCR
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
Expand Down

0 comments on commit 635490f

Please sign in to comment.