# Sample: build (and optionally push) a Docker image with Gitea Actions. # Copy into your repo as `.gitea/workflows/docker-build.yaml` and push. # Requires a runner with `ubuntu-latest` that can reach a Docker daemon # (the compose file bind-mounts /var/run/docker.sock for this). # # To push, create Gitea repo secrets REGISTRY, REGISTRY_USERNAME, # REGISTRY_PASSWORD, IMAGE_NAME and uncomment the login/push steps. name: docker-build on: push: branches: [main] pull_request: workflow_dispatch: jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Build image (no push) uses: docker/build-push-action@v6 with: context: . push: false tags: sample-app:ci cache-from: type=gha cache-to: type=gha,mode=max # - name: Log in to registry # uses: docker/login-action@v3 # with: # registry: ${{ secrets.REGISTRY }} # username: ${{ secrets.REGISTRY_USERNAME }} # password: ${{ secrets.REGISTRY_PASSWORD }} # # - name: Build and push # uses: docker/build-push-action@v6 # with: # context: . # push: true # tags: ${{ secrets.REGISTRY }}/${{ secrets.IMAGE_NAME }}:${{ gitea.sha }}