diff --git a/.github/workflows/docker_local_cache.yml b/.github/workflows/docker_local_cache.yml new file mode 100644 index 00000000..869b77b8 --- /dev/null +++ b/.github/workflows/docker_local_cache.yml @@ -0,0 +1,48 @@ +name: Docker build (cache w/ docker) + +on: + workflow_dispatch: + push: + branches: [ "master", "main", "maint/*", "gha-docker-build" ] + tags: "*" + pull_request: + branches: [ "master", "main", "maint/*" ] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + FORCE_COLOR: true + +jobs: + build-container: + runs-on: local + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v5 + with: + fetch-depth: 200 + fetch-tags: true + + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | docker login ${{ env.REGISTRY }} -u ${{ github.actor }} --password-stdin + + - name: Extract Docker metadata + id: meta + run: | + # Simple tag generation + TAGS="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:main" + echo "tags=${TAGS}" >> $GITHUB_OUTPUT + echo "labels=" >> $GITHUB_OUTPUT + + - name: Build and push Docker image + run: | + docker build -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:main .