|
| 1 | +name: docker-build-proxy |
| 2 | + |
| 3 | +env: |
| 4 | + registry: ghcr.io |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + tags: |
| 9 | + - "*" |
| 10 | +jobs: |
| 11 | + build-and-push: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + |
| 14 | + steps: |
| 15 | + - name: Get image tags |
| 16 | + id: tag |
| 17 | + run: | |
| 18 | + if [[ ${GITHUB_REF_TYPE} == tag ]]; then |
| 19 | + tag=${GITHUB_REF##*/} |
| 20 | + else |
| 21 | + tag=${{ github.event.inputs.custom_tag }} |
| 22 | + fi |
| 23 | + echo "Tag: ${tag}" |
| 24 | + echo "tag=$tag" >> $GITHUB_OUTPUT |
| 25 | + - name: Checkout Server |
| 26 | + uses: actions/checkout@v4 |
| 27 | + with: |
| 28 | + ref: ${{ steps.tag.outputs.tag }} |
| 29 | + |
| 30 | + - name: Create docker context |
| 31 | + run: | |
| 32 | + docker context create ctx |
| 33 | + - name: Set up QEMU |
| 34 | + uses: docker/setup-qemu-action@v2 |
| 35 | + |
| 36 | + - name: Set up Docker Buildx |
| 37 | + uses: docker/setup-buildx-action@v2 |
| 38 | + id: buildx |
| 39 | + with: |
| 40 | + endpoint: ctx |
| 41 | + driver-opts: env.BUILDKIT_STEP_LOG_MAX_SIZE=10485760,env.BUILDKIT_STEP_LOG_MAX_SPEED=10485760 |
| 42 | + |
| 43 | + - name: Inspect builder |
| 44 | + run: | |
| 45 | + echo "Name: ${{ steps.buildx.outputs.name }}" |
| 46 | + echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}" |
| 47 | + echo "Status: ${{ steps.buildx.outputs.status }}" |
| 48 | + echo "Flags: ${{ steps.buildx.outputs.flags }}" |
| 49 | + echo "Platforms: ${{ steps.buildx.outputs.platforms }}" |
| 50 | + echo "Build tag ${{ steps.tag.outputs.tag }}" |
| 51 | + - name: Login to GHRC |
| 52 | + uses: docker/login-action@v2 |
| 53 | + with: |
| 54 | + registry: ${{ env.registry }} |
| 55 | + username: ${{ github.actor }} |
| 56 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 57 | + |
| 58 | + - name: Build and push |
| 59 | + uses: docker/build-push-action@v6 |
| 60 | + with: |
| 61 | + context: ./ |
| 62 | + platforms: linux/amd64,linux/arm64 |
| 63 | + push: true |
| 64 | + tags: ${{ env.registry }}/${{ github.repository }}:${{ steps.tag.outputs.tag }}, ${{ env.registry }}/${{ github.repository }}:latest |
| 65 | + builder: ${{ steps.buildx.outputs.name }} |
| 66 | + file: ./Dockerfile |
| 67 | + provenance: false |
0 commit comments