diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..daa7808 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,49 @@ +name: Build docker + +on: + workflow_dispatch: + push: + branches: + - "**" + paths: + - ".github/workflows/build.yml" + - "src/**" + - "**.py" + pull_request: + branches: + - "**" + paths: + - ".github/workflows/build.yml" + - "src/**" + - "**.py" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install deps + run: python -m pip install -r requirements.txt + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io${{ env.REGISTRY }}/${{ github.repository }} + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + push: true + tags: "ghcr.io/mirrorchyan/billing-backend:latest" + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file