diff --git a/.github/workflows/docker-build-push.yml b/.github/workflows/docker-build-push.yml new file mode 100644 index 0000000..7a365bb --- /dev/null +++ b/.github/workflows/docker-build-push.yml @@ -0,0 +1,59 @@ +name: Build & Push Docker Image + +on: + push: + branches: [main] + tags: ["v*"] + pull_request: + branches: [main] + workflow_dispatch: + +env: + IMAGE: ghcr.io/${{ github.repository_owner }}/librecrawl + +jobs: + build-and-push: + name: Build & Push to GHCR + runs-on: ubuntu-latest + permissions: + contents: read + packages: write # this is all you need — no extra secrets + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GitHub Container Registry + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE }} + tags: | + type=raw,value=latest,enable={{is_default_branch}} + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=sha,prefix=sha- + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Image digest + run: echo "Pushed ${{ steps.meta.outputs.tags }}" diff --git a/Dockerfile b/Dockerfile index 06f084a..1114541 100644 --- a/Dockerfile +++ b/Dockerfile @@ -67,4 +67,4 @@ ENV PYTHONUNBUFFERED=1 # Run the application # The command is handled by docker-compose.yml -CMD ["python", "main.py"] +CMD ["python", "main.py", "--local"]