From 0bf7f038101ad7fd51333118ee16fba6ad5be611 Mon Sep 17 00:00:00 2001 From: Adrian Kosmaczewski Date: Tue, 28 Mar 2023 14:12:51 +0200 Subject: [PATCH] Moved container to ghcr.io --- .github/workflows/container.yml | 60 ++++++++++++++++++++++++++++++ .github/workflows/docker-image.yml | 40 -------------------- Dockerfile | 17 ++++----- Makefile | 2 +- README.adoc | 13 +++---- 5 files changed, 75 insertions(+), 57 deletions(-) create mode 100644 .github/workflows/container.yml delete mode 100644 .github/workflows/docker-image.yml 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 d409c25..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 }} # same name/app on dockerhub as on github - - 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 }} # push both tag name and "latest" on new git tag - 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 5a157c8..e2a8a4b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,27 +1,27 @@ ############################ # STEP 1 ############################ -FROM golang:alpine AS builder +FROM docker.io/library/golang:alpine AS builder # Install build tools RUN apk update && apk add --no-cache wget zip tar WORKDIR / -RUN wget https://github.com/errata-ai/vale/releases/download/v2.15.4/vale_2.15.4_Linux_64-bit.tar.gz && \ - tar -xvzf vale_2.15.4_Linux_64-bit.tar.gz +RUN wget -q https://github.com/errata-ai/vale/releases/download/v2.15.4/vale_2.15.4_Linux_64-bit.tar.gz && \ + tar -xzf vale_2.15.4_Linux_64-bit.tar.gz # Install Microsoft style file -RUN wget https://github.com/errata-ai/Microsoft/releases/download/v0.9.0/Microsoft.zip && \ - unzip Microsoft.zip +RUN wget -q https://github.com/errata-ai/Microsoft/releases/download/v0.9.0/Microsoft.zip && \ + unzip -qq Microsoft.zip # Install Openly style file -RUN wget https://github.com/testthedocs/Openly/releases/download/0.3.1/Openly.zip && \ - unzip Openly.zip +RUN wget -q https://github.com/testthedocs/Openly/releases/download/0.3.1/Openly.zip && \ + unzip -qq Openly.zip ############################ # STEP 2 ############################ -FROM alpine:3.17.2 +FROM docker.io/library/alpine:3.17.2 RUN apk add --update \ python3 \ @@ -40,4 +40,3 @@ COPY vale.ini /.vale.ini COPY Vocab /styles/Vocab ENTRYPOINT ["/usr/local/bin/vale"] - diff --git a/Makefile b/Makefile index 251071f..3be2c9a 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ all: build build: - docker build -t vshn/vale . + podman build -t vshn/vale . diff --git a/README.adoc b/README.adoc index 532f9c1..2e3cf41 100644 --- a/README.adoc +++ b/README.adoc @@ -1,10 +1,10 @@ = Vale for VSHN -This project generates a ready-to-use installation of the https://github.com/errata-ai/vale[vale tool], a "syntax-aware linter for prose built with speed and extensibility in mind." +This project generates a ready-to-use installation of the https://github.com/errata-ai/vale[vale], a "syntax-aware linter for prose built with speed and extensibility in mind." This image is geared specifically to verify Asciidoc files using the Microsoft, Openly and built-in Vale text style rules. It contains: -* `vale` +* https://github.com/errata-ai/vale[vale] * https://github.com/errata-ai/Microsoft[Microsoft style rules] * https://github.com/testthedocs/Openly[Openly style rules] * https://asciidoctor.org/[Asciidoctor] @@ -13,8 +13,7 @@ This image is geared specifically to verify Asciidoc files using the Microsoft, Use it as follows, for example on an Antora project root, to verify all Asciidoc files in that folder: -`docker run --rm -t -v $(pwd)/modules/ROOT/pages:/pages vshn/vale /pages` - -You can also specify an individual file instead of a whole folder: - -`docker run --rm -t -v $(pwd)/modules/ROOT/pages:/pages vshn/vale /pages/file.adoc` +[source,bash] +-- +podman run --rm --volume "${PWD}"/src/modules/ROOT/pages:/pages --workdir /pages ghcr.io/vshn/vale:2.15.5 --minAlertLevel=error . +--