From a7442633da455138535e365f1883d33da4754b56 Mon Sep 17 00:00:00 2001 From: Abderrahmane Smimite Date: Mon, 8 Apr 2024 19:56:07 +0200 Subject: [PATCH] Build and Push to ghcr --- .github/workflows/docker-build-and-push.yml | 40 +++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/docker-build-and-push.yml 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