Skip to content

Commit

Permalink
Fix docker CI for PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
peixian committed Feb 14, 2025
1 parent 515e365 commit 217e934
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 8 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/docker-build-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Docker Image Build for PRs

# Run on every push to main + weekly, Sunday @ midnight
# to keep the image fresh
on:
pull_request:
types: [opened, reopened, sychronize]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: facebook/whatsapp_proxy
tags: |
type=raw,value={{date 'YYYYMMDD'}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

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

- name: Build PR
uses: docker/build-push-action@v3
with:
context: ./proxy
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
push: false
tags: |
${{ steps.meta.outputs.tags }}
facebook/whatsapp_proxy:latest
12 changes: 4 additions & 8 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Docker Image CI
name: Docker Build and PR for Main

# Run on every push to main + weekly, Sunday @ midnight
# to keep the image fresh
Expand All @@ -7,9 +7,6 @@ on:
branches: [ "main" ]
schedule:
- cron: "0 0 * * 0"
# On pull-requests only a build is run, not a push to Docker Hub
pull_request:
types: [opened, reopened, synchronize]

jobs:

Expand All @@ -19,7 +16,7 @@ jobs:

steps:
- uses: actions/checkout@v3

- name: Docker metadata
id: meta
uses: docker/metadata-action@v4
Expand All @@ -33,13 +30,13 @@ jobs:

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

- name: Login to dockerhub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
with:
Expand All @@ -49,4 +46,3 @@ jobs:
tags: |
${{ steps.meta.outputs.tags }}
facebook/whatsapp_proxy:latest

0 comments on commit 217e934

Please sign in to comment.