Bump Kitsu and Zou versions (0.19.54 and 0.19.52) & upgrade to Ubuntu… #53
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker | |
on: | |
push: | |
branches: [ "master" ] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
config: .github/buildkitd.toml | |
- name: Extract Kitsu & Zou versions | |
id: versions | |
run: | | |
echo "ZOU_VERSION=$(grep 'ARG ZOU_VERSION' Dockerfile | sed 's/.*=//')" >> $GITHUB_OUTPUT | |
echo "KITSU_VERSION=$(grep 'ARG KITSU_VERSION' Dockerfile | sed 's/.*=//')" >> $GITHUB_OUTPUT | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: cgwire/cgwire | |
tags: | | |
type=raw,value=latest,enable={{is_default_branch}} | |
type=raw,value=${{ steps.versions.outputs.KITSU_VERSION}} | |
type=raw,value=${{ steps.versions.outputs.KITSU_VERSION }}-${{ steps.versions.outputs.ZOU_VERSION }} | |
type=sha,prefix={{branch}}- | |
type=ref,event=branch | |
type=ref,event=tag | |
- name: Build Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
# amd64 | |
- name: Load Docker amd64 image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64 | |
load: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Test docker amd64 image | |
run: | | |
export CONTAINER_ARCH=arm64 | |
export CONTAINER_NAME=cgwire-${CONTAINER_ARCH} | |
export LOCAL_PORT=8001 | |
> docker-${CONTAINER_ARCH}.env | |
echo "KITSU_VERSION=${{ steps.versions.outputs.KITSU_VERSION }}" >> docker-${CONTAINER_ARCH}.env | |
echo "ZOU_VERSION=${{ steps.versions.outputs.ZOU_VERSION }}" >> docker-${CONTAINER_ARCH}.env | |
docker container run --platform=linux/amd64 -d --init -p ${LOCAL_PORT}:80 --rm --name ${CONTAINER_NAME} cgwire/cgwire:latest | |
echo "KITSU_URL=http://$(docker inspect ${CONTAINER_NAME} | jq -r '.[0]["NetworkSettings"]["IPAddress"]')" >> docker-${CONTAINER_ARCH}.env | |
sleep 10 | |
docker container run --env-file docker-${CONTAINER_ARCH}.env cgwire/kitsu-checker:latest | |
docker kill ${CONTAINER_NAME} | |
# arm64 | |
- name: Load Docker arm64 image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/arm64 | |
load: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Test docker arm64 image | |
run: | | |
export CONTAINER_ARCH=arm64 | |
export CONTAINER_NAME=cgwire-${CONTAINER_ARCH} | |
export LOCAL_PORT=8002 | |
> docker-${CONTAINER_ARCH}.env | |
echo "KITSU_VERSION=${{ steps.versions.outputs.KITSU_VERSION }}" >> docker-${CONTAINER_ARCH}.env | |
echo "ZOU_VERSION=${{ steps.versions.outputs.ZOU_VERSION }}" >> docker-${CONTAINER_ARCH}.env | |
docker container run --platform=linux/arm64 -d --init -p ${LOCAL_PORT}:80 --rm --name ${CONTAINER_NAME} cgwire/cgwire:latest | |
echo "KITSU_URL=http://$(docker inspect ${CONTAINER_NAME} | jq -r '.[0]["NetworkSettings"]["IPAddress"]')" >> docker-${CONTAINER_ARCH}.env | |
sleep 30 | |
docker container run --env-file docker-${CONTAINER_ARCH}.env cgwire/kitsu-checker:latest | |
docker kill ${CONTAINER_NAME} | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Push Docker image | |
if: github.event_name != 'pull_request' | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |