diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml new file mode 100644 index 0000000..20a4c87 --- /dev/null +++ b/.github/workflows/container.yml @@ -0,0 +1,60 @@ +# 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. + +# GitHub recommends pinning actions to a commit SHA. +# To get a newer version, you will need to update the SHA. +# You can also reference a tag or branch, but the action may change without warning. + +name: Create and publish a container image + +on: + push: + branches: [ master ] + tags: [ '*' ] + pull_request: + branches: [ master ] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log in to the Container registry + uses: docker/login-action@219c305e1ce92a755f3aa4ba17387c95df31e987 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 + with: + context: . + push: true + platforms: linux/amd64,linux/arm64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml deleted file mode 100644 index e51f26b..0000000 --- a/.github/workflows/docker-image.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: CD to Docker Hub - -on: - push: - branches: [ master ] - tags: [ '*' ] - pull_request: - branches: [ master ] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Check out the repo - uses: actions/checkout@v3 - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Docker labels & tags metadata - id: meta - uses: docker/metadata-action@v4 - with: - images: ${{ github.repository }} # name/app - - name: Log in to Docker Hub - if: github.event_name != 'pull_request' - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKER_HUB_USERNAME }} - password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - - name: Build and push to Docker Hub - uses: docker/build-push-action@v4 - with: - context: . - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - platforms: linux/amd64,linux/arm64 - cache-from: type=gha - cache-to: type=gha,mode=max diff --git a/Makefile b/Makefile index 3b0596e..563b7ea 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ all: image image: - docker build -t vshn/asciidoctor-pdf:1.14.2 . + podman build -t ghcr.io/vshn/asciidoctor-pdf:master . build/test.pdf: - docker run --rm --tty --user "$$(id -u)" --volume "$${PWD}":/documents vshn/asciidoctor-pdf:1.14.2 --destination-dir=build sample/test.adoc + podman run --rm --volume "$${PWD}":/documents ghcr.io/vshn/asciidoctor-pdf:master --destination-dir=build sample/test.adoc clean: rm -rf build diff --git a/README.adoc b/README.adoc index a72585e..1930c7e 100644 --- a/README.adoc +++ b/README.adoc @@ -1,8 +1,6 @@ = VSHN PDF Generator based on Asciidoctor -This project generates a Docker image to be used to generate PDF books with a standard VSHN style and fonts. - -The image is available in https://hub.docker.com/r/vshn/asciidoctor-pdf[Docker Hub]. +This project generates a container image to be used to generate PDF books with a standard VSHN style and fonts. == Build @@ -12,11 +10,11 @@ Run the `make` command to build the image. Run the following command to build a PDF using an Asciidoc file as a basis: -`docker run --rm --tty --user "$(id -u)" --volume "${PWD}":/documents vshn/asciidoctor-pdf:1.14.1 file.adoc` +`podman run --rm --volume "${PWD}":/documents ghcr.io/vshn/asciidoctor-pdf:1.39.1 file.adoc` Any parameters passed after the command line will be fed directly to Asciidoctor, for example -`docker run --rm --tty --user "$(id -u)" --volume "${PWD}":/documents vshn/asciidoctor-pdf:1.14.1 file.adoc --destination-dir=./_archive` +`podman run --rm --volume "${PWD}":/documents ghcr.io/vshn/asciidoctor-pdf:1.39.1 file.adoc --destination-dir=./_archive` == Default Attributes