diff --git a/.github/workflows/docker-build-and-push.yml b/.github/workflows/docker-build-and-push.yml new file mode 100644 index 0000000000..0d1da9a55c --- /dev/null +++ b/.github/workflows/docker-build-and-push.yml @@ -0,0 +1,40 @@ +name: Build and Push Docker Images + +on: + push: + branches: + - main + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and Push Backend Docker Image + uses: docker/build-push-action@v3 + with: + context: ./backend + file: ./backend/Dockerfile + push: true + tags: ghcr.io/${{ github.repository }}/backend:latest + + - name: Build and Push Frontend Docker Image + uses: docker/build-push-action@v3 + with: + context: ./frontend + file: ./frontend/Dockerfile + push: true + tags: ghcr.io/${{ github.repository }}/frontend:latest