Create docker-publish.yml #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Push Docker Image | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build Docker image | |
| run: | | |
| docker build -t 34v0wphix/new-api:${{ github.sha }} . | |
| docker tag 34v0wphix/new-api:${{ github.sha }} 34v0wphix/new-api:latest | |
| - name: Push Docker image | |
| run: | | |
| docker push 34v0wphix/new-api:${{ github.sha }} | |
| docker push 34v0wphix/new-api:latest |