diff --git a/.github/workflows/docker-publish..yml b/.github/workflows/docker-publish..yml index 1635ae8..ed63452 100644 --- a/.github/workflows/docker-publish..yml +++ b/.github/workflows/docker-publish..yml @@ -1,10 +1,5 @@ name: Publish Docker Image to GHCR -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - on: workflow_dispatch: release: @@ -28,69 +23,87 @@ jobs: # This is used to complete the identity challenge # with sigstore/fulcio when running outside of PRs. id-token: write + strategy: + matrix: + platform: + - linux/amd64 + - linux/arm64 steps: - name: Checkout repository uses: actions/checkout@v4 - - name: Setup Docker buildx - uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 - - # Login against a Docker registry only when tag "vM.M.P" - # https://github.com/docker/login-action - - name: Login to image registry ${{ env.REGISTRY }} - if: startsWith(github.ref, 'refs/tags/v') - uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + - name: Cat Dockerfile + run: cat Dockerfile # Extract metadata (tags, labels) for Docker # https://github.com/docker/metadata-action - name: Extract Docker metadata id: meta - uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 + uses: docker/metadata-action@v4 with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - flavor: | - latest=auto + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | + type=schedule type=ref,event=branch type=ref,event=pr type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha + env: + DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v3 + + # login to ghcr only when tagged with "v*" + - name: Login to image registry ${{ env.REGISTRY }} + if: startsWith(github.ref, 'refs/tags/v') + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} # Build and push Docker image with Buildx (don't push on PR) - # https://github.com/docker/build-push-action - name: Build and push Docker image id: build-and-push uses: docker/build-push-action@v5 with: context: . - push: ${{ startsWith(github.ref, 'refs/tags/v') }} + platforms: ${{ matrix.platform }} + #push: ${{ startsWith(github.ref, 'refs/tags/v') }} + push: false tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max + annotations: ${{ steps.meta.outputs.annotations }} + provenance: mode=max + sbom: true + outputs: | + type=image,name=target,annotation-index.org.opencontainers.image.title=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.title'] }},annotation-index.org.opencontainers.image.description=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.description'] }},annotation-index.org.opencontainers.image.licenses=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.licenses'] }},annotation-index.org.opencontainers.image.documentation=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.documentation'] }},annotation-index.org.opencontainers.image.source=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.source'] }},annotation-index.org.opencontainers.image.url=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.url'] }} + # BuildKit doesn't preserve cache mounts in the GitHub Actions cache by default + # see: https://docs.docker.com/build/ci/github-actions/cache/#cache-mounts + # cache-from: type=gha + # cache-to: type=gha,mode=max # Install the cosign tool except on PR # https://github.com/sigstore/cosign-installer - name: Install cosign if: startsWith(github.ref, 'refs/tags/v') - uses: sigstore/cosign-installer@main - with: - cosign-release: 'v1.13.1' + uses: sigstore/cosign-installer@v3.4.0 - # Sign the resulting Docker image digest except on PRs. - # This will only write to the public Rekor transparency log when the Docker - # repository is public to avoid leaking data. If you would like to publish - # transparency data even for private images, pass --force to cosign below. - # https://github.com/sigstore/cosign - - name: Sign the published Docker image + - name: Sign the images with GitHub OIDC Token if: startsWith(github.ref, 'refs/tags/v') env: - COSIGN_EXPERIMENTAL: "true" - # This step uses the identity token to provision an ephemeral certificate - # against the sigstore community Fulcio instance. - run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }} + DIGEST: ${{ steps.build-and-push.outputs.digest }} + TAGS: ${{ steps.meta.outputs.tags }} + run: | + images="" + for tag in ${TAGS}; do + images+="${tag}@${DIGEST} " + done + cosign sign --yes ${images} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 496d27d..73b4cc6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ ARG GID=worker ARG VERSION_UNOSERVER=2.0.1 LABEL org.opencontainers.image.title="unoserver-docker" -LABEL org.opencontainers.image.description="Custom Docker Image that contains unoserver, LibreOffice and major set of fonts for file format conversions" +LABEL org.opencontainers.image.description="Custom Container Image that contains unoserver, LibreOffice and major set of fonts for file format conversions" LABEL org.opencontainers.image.licenses="MIT" LABEL org.opencontainers.image.documentation="https://github.com/unoconv/unoserver-docker/blob/master/README.adoc" LABEL org.opencontainers.image.source="https://github.com/unoconv/unoserver-docker" diff --git a/README.adoc b/README.adoc index 582a67e..7e255ac 100644 --- a/README.adoc +++ b/README.adoc @@ -1,10 +1,10 @@ -= Unoserver Docker Image += Unoserver Container Image -Docker image for unoserver +Container image for unoserver == The environment -This Docker image uses Alpine Linux as a base image and provides: +This Container image uses Alpine Linux as a base image and provides: * link:https://www.libreoffice.org/[LibreOffice] * link:https://github.com/unoconv/unoserver[unoserver] @@ -25,6 +25,8 @@ This Docker image uses Alpine Linux as a base image and provides: == How to use it +NOTE: The `docker` can normally be replaced with `podman` as well. + === In interactive mode Just run: @@ -80,6 +82,7 @@ You need the following tools: === How to build +[source,bash] ---- docker build . ----