Skip to content

Commit

Permalink
🚀 Enhance CI/CD: Add Docker build and push to DockerHub
Browse files Browse the repository at this point in the history
- Build Docker image after successful tests and deployment
- Push to DockerHub on main branch updates only
- Integrate with existing Vercel deployment workflow
  • Loading branch information
ad956 committed Oct 4, 2024
1 parent acf1a75 commit 10734b0
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/test-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,25 @@ jobs:
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy to Vercel Production
run: vercel deploy --prod --token=${{ secrets.VERCEL_TOKEN }}

build-and-push-docker:
needs: [test, deploy-production]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/[email protected]
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Login to DockerHub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/[email protected]
with:
context: .
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/pft:latest

0 comments on commit 10734b0

Please sign in to comment.