Skip to content

Commit

Permalink
Moved container to ghcr.io
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Kosmaczewski committed Mar 28, 2023
1 parent e32e572 commit 45e85ca
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 94 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
@@ -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 }}
40 changes: 0 additions & 40 deletions .github/workflows/docker-image.yml

This file was deleted.

9 changes: 4 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# 1. Builder image
FROM alpine:3.11 AS builder
FROM alpine:3.17 AS builder

# Clone latest dictionaries
WORKDIR /root
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
Expand All @@ -32,4 +32,3 @@ RUN touch /usr/share/hunspell/vshn.aff
RUN hunspell -v && hunspell -D

ENTRYPOINT ["/usr/bin/hunspell"]

16 changes: 7 additions & 9 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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`
--
40 changes: 0 additions & 40 deletions renovate.json

This file was deleted.

0 comments on commit 45e85ca

Please sign in to comment.