diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index e69de29..f11a723 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,27 @@ +name: Build and Push Docker Image + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Login 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 ${{ secrets.DOCKERHUB_USERNAME }}/step-final-project:v1.0.0 . + + - name: Push Docker Image + run: | + docker push ${{ secrets.DOCKERHUB_USERNAME }}/step-final-project:v1.0.0