Skip to content

Update docker compose file (#6) #76

Update docker compose file (#6)

Update docker compose file (#6) #76

Workflow file for this run

name: Create and publish Docker image
on:
push:
branches:
- 'main'
tags:
- 'v*'
pull_request:
branches:
- 'main'
- 'release/**'
workflow_dispatch:
inputs:
build_platforms:
description: The Docker image build platforms
type: string
required: true
default: linux/amd64,linux/arm/v7,linux/arm/v8
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
BUILD_PLATFORMS: ${{ inputs.build_platforms || 'linux/amd64,linux/arm/v7,linux/arm/v8' }}
jobs:
changes:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
sogo: ${{ steps.filter.outputs.sogo }}
steps:
- name: Checkout repository
if: github.event_name != 'pull_request'
uses: actions/checkout@v4
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
filters: |
sogo:
- Dockefile
- versions.yaml
- 'sogo-conf/**'
- 'nginx-conf/**'
- 'artifacts/**'
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT" | head -c 512
sogo:
needs: changes
if: needs.changes.outputs.sogo == 'true' || ( github.event_name == 'push' && github.ref_type == 'tag' )
runs-on: ubuntu-latest
permissions: # permissions for GITHUB_TOKEN
contents: read
packages: write
attestations: write
id-token: write
steps:
# - name: Login to Docker Hub
# uses: docker/login-action@v3
# with:
# username: ${{ vars.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@v4
- name: Login to the Container registry
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Set up QEMU
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
- name: Build and push Docker image
id: push
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ env.BUILD_PLATFORMS }}
- name: Generate artifact attestation
if: github.event.repository.visibility == 'public'
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true