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 efa3cd6 commit 91b23e4
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 23 deletions.
58 changes: 39 additions & 19 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
name: CD to Docker Hub
# 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:
Expand All @@ -7,34 +16,45 @@ on:
pull_request:
branches: [ master ]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Check out the repo
- 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: Docker labels & tags metadata
id: meta
uses: docker/metadata-action@v4

- name: Log in to the Container registry
uses: docker/login-action@219c305e1ce92a755f3aa4ba17387c95df31e987
with:
images: vshn/antora
- name: Log in to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
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:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and push to Docker Hub
uses: docker/build-push-action@v4
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
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 }}
push: true
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
6 changes: 2 additions & 4 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
= Custom Antora Image

This repository builds an extended https://antora.org/[Antora] Docker image, used to build documentation projects at VSHN.
This repository builds an extended https://antora.org/[Antora] container image, used to build documentation projects at VSHN.

It is based on the information provided in the https://docs.antora.org/antora/2.1/antora-container/[Antora documentation].

The image is available at Docker Hub as https://hub.docker.com/r/vshn/antora[vshn/antora].

== Usage

Use the following commands on the root of an Antora project. In both cases you should have an output folder with the documentation following the instructions in the `playbook.yml` file.
Expand All @@ -14,7 +12,7 @@ Use the following commands on the root of an Antora project. In both cases you s

[source,bash]
--
podman run --rm --volume "${PWD}":/antora docker.io/vshn/antora:${VERSION} playbook.yml --cache-dir=.cache/antora
podman run --rm --volume "${PWD}":/antora ghcr.io/vshn/antora:${VERSION} playbook.yml --cache-dir=.cache/antora
--

=== Docker
Expand Down

0 comments on commit 91b23e4

Please sign in to comment.