mirror of
https://github.com/isboyjc/GoProxy.git
synced 2026-05-07 07:22:57 +08:00
fix: 🐛 update README and Docker setup documentation for GitHub Container Registry support
This commit is contained in:
40
.github/workflows/docker-image.yml
vendored
40
.github/workflows/docker-image.yml
vendored
@@ -30,13 +30,24 @@ jobs:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
- name: Extract metadata for GHCR
|
||||
id: meta-ghcr
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
${{ env.REGISTRY_DOCKERHUB }}/${{ env.IMAGE_NAME }}
|
||||
${{ env.REGISTRY_GHCR }}/${{ env.IMAGE_NAME }}
|
||||
images: ${{ env.REGISTRY_GHCR }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Extract metadata for Docker Hub
|
||||
id: meta-dockerhub
|
||||
if: secrets.DOCKERHUB_USERNAME != ''
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY_DOCKERHUB }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=semver,pattern={{version}}
|
||||
@@ -45,7 +56,7 @@ jobs:
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Login to Docker Hub
|
||||
if: github.event_name != 'pull_request'
|
||||
if: github.event_name != 'pull_request' && secrets.DOCKERHUB_USERNAME != ''
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY_DOCKERHUB }}
|
||||
@@ -60,13 +71,24 @@ jobs:
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
- name: Build and push to GHCR
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
tags: ${{ steps.meta-ghcr.outputs.tags }}
|
||||
labels: ${{ steps.meta-ghcr.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Build and push to Docker Hub
|
||||
if: github.event_name != 'pull_request' && secrets.DOCKERHUB_USERNAME != ''
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta-dockerhub.outputs.tags }}
|
||||
labels: ${{ steps.meta-dockerhub.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
|
||||
Reference in New Issue
Block a user