From af1c32efa6a391d78059b7aaa8b1663ffce8e830 Mon Sep 17 00:00:00 2001 From: echska Date: Sun, 10 May 2026 00:07:12 +0300 Subject: [PATCH] Add GitHub Actions workflow to build and push backend image --- .github/workflows/backend-docker.yml | 52 ++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/backend-docker.yml diff --git a/.github/workflows/backend-docker.yml b/.github/workflows/backend-docker.yml new file mode 100644 index 0000000..67a01d2 --- /dev/null +++ b/.github/workflows/backend-docker.yml @@ -0,0 +1,52 @@ +name: Build and Push Backend Docker Image + +on: + push: + branches: [ "main" ] + paths: + - "parental-control-system/backend/**" + - ".github/workflows/backend-docker.yml" + workflow_dispatch: + +permissions: + contents: read + packages: write + +env: + IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/parental-control-backend + +jobs: + docker: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE_NAME }} + tags: | + type=sha + type=raw,value=latest + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: ./parental-control-system/backend + file: ./parental-control-system/backend/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}