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/Dockerfile b/Dockerfile index f8c1ba9..cde49bc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # 1. Builder image -FROM alpine:3.11 AS builder +FROM alpine:3.17 AS builder # Clone latest dictionaries WORKDIR /root @@ -7,15 +7,15 @@ RUN apk add --no-cache git RUN git clone --depth 1 -o 5ede45bb705d3f9f525ea779f7b487f9fc062013 https://github.com/wooorm/dictionaries.git # 2. Runtime image -FROM alpine:3.11 +FROM alpine:3.17 WORKDIR /spell RUN apk add --no-cache hunspell # Copy only required dictionaries RUN sh -c 'mkdir -pv /usr/share/hunspell' -COPY --from=builder /root/dictionaries/dictionaries/en/index.aff /usr/share/hunspell/en.aff -COPY --from=builder /root/dictionaries/dictionaries/en/index.dic /usr/share/hunspell/en.dic +COPY --from=builder /root/dictionaries/dictionaries/en/index.aff /usr/share/hunspell/default.aff +COPY --from=builder /root/dictionaries/dictionaries/en/index.dic /usr/share/hunspell/default.dic COPY --from=builder /root/dictionaries/dictionaries/de-CH/index.aff /usr/share/hunspell/de.aff COPY --from=builder /root/dictionaries/dictionaries/de-CH/index.dic /usr/share/hunspell/de.dic COPY --from=builder /root/dictionaries/dictionaries/fr/index.aff /usr/share/hunspell/fr.aff @@ -32,4 +32,3 @@ RUN touch /usr/share/hunspell/vshn.aff RUN hunspell -v && hunspell -D ENTRYPOINT ["/usr/bin/hunspell"] - diff --git a/README.adoc b/README.adoc index bf6c3cf..fdda8c8 100644 --- a/README.adoc +++ b/README.adoc @@ -1,6 +1,6 @@ = Hunspell for VSHN -This project builds a Docker image encapsulating https://hunspell.github.io/[hunspell], to spell check the contents of documents produced at VSHN. The Docker image is available in https://hub.docker.com/r/vshn/hunspell[Docker Hub]. +This project builds a container image encapsulating https://hunspell.github.io/[hunspell], to spell check the contents of documents produced at VSHN. == Exceptions @@ -18,15 +18,13 @@ The version of `hunspell` provided in this image _only_ contains dictionaries fo * German * French -NOTE: You can check the list of available dictionaries using the command `docker run --rm --user "$(id -u)" --volume $(pwd):/spell vshn/hunspell:1.7.0 -D` - -== Versioning - -The Docker images have the same version as the `hunspell` binary contained within. +NOTE: You can check the list of available dictionaries using the command `podman run --rm --volume $(pwd):/spell ghcr.io/vshn/hunspell:1.7.0.2 -D` == Usage -For example, after building the https://handbook.vshn.ch[VSHN Handbook] with the `make html` command, you can run the following command to check the spelling of all HTML files: - -`docker run --rm --user "$(id -u)" --volume $(pwd):/spell vshn/hunspell:1.7.0 -d en,vshn -l -H _public/\**/\*.html` +For example, after building an Antora website with the `make html` command, you can run the following command to check the spelling of all HTML files: +[source,bash] +-- +podman run --rm --volume $(pwd):/spell ghcr.io/vshn/hunspell:1.7.0.2 -d default,vshn -l -H _public/\**/\*.html` +-- diff --git a/renovate.json b/renovate.json deleted file mode 100644 index e51f26b..0000000 --- a/renovate.json +++ /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