added github action to push container images

This commit is contained in:
pushrbx 2022-10-23 15:55:03 +01:00
parent 2ec635f47b
commit bb7b59c244
3 changed files with 111 additions and 1 deletions

View File

@ -11,3 +11,8 @@ updates:
interval: "daily"
allow:
- dependency-name: "jikan*"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"

View File

@ -0,0 +1,103 @@
name: Container Image Release
concurrency: production
on:
workflow_dispatch:
jobs:
release-base-image:
runs-on: ubuntu-latest
strategy:
matrix:
baseImagePhpVersion: ['8.0', '8.1']
name: Release base container image / PHP ${{ matrix.baseImagePhpVersion }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up qemu
uses: docker/setup-qemu-action@v2
- name: Set up docker buildx
uses: docker/setup-buildx-action@v2
with:
platforms: linux/amd64,linux/arm64
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
with:
push: true
context: ./docker/base_image/php-${{ matrix.baseImagePhpVersion }}
cache-from: type=registry,ref=ghcr.io/jikan-me/jikan-rest-php:${{ matrix.baseImagePhpVersion }}-${{ github.sha }}
cache-to: type=inline
build-args: |
GITHUB_PERSONAL_TOKEN=${{ secrests.GITHUB_TOKEN }}
tags: |
ghcr.io/jikan-me/jikan-rest-php:${{ matrix.baseImagePhpVersion }}
ghcr.io/jikan-me/jikan-rest-php:${{ matrix.baseImagePhpVersion }}-${{ github.sha }}
jikanme/jikan-rest-php:${{ matrix.baseImagePhpVersion }}
jikanme/jikan-rest-php:${{ matrix.baseImagePhpVersion }}-${{ github.sha }}
release-app-image:
runs-on: ubuntu-latest
strategy:
matrix:
baseImagePhpVersion: [ '8.0', '8.1' ]
needs: Release base container image / PHP ${{ matrix.baseImagePhpVersion }}
name: Release App container image / PHP ${{ matrix.baseImagePhpVersion }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up qemu
uses: docker/setup-qemu-action@v2
- name: Set up docker buildx
uses: docker/setup-buildx-action@v2
with:
platforms: linux/amd64,linux/arm64
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
with:
push: true
context: .
cache-from: type=registry,ref=ghcr.io/jikan-me/jikan-rest:${{ matrix.baseImagePhpVersion }}-${{ github.sha }}
cache-to: type=inline
build-args: |
GITHUB_PERSONAL_TOKEN=${{ secrests.GITHUB_TOKEN }}
BASE_IMAGE_VERSION=${{ matrix.baseImagePhpVersion }}
tags: |
ghcr.io/jikan-me/jikan-rest:latest
ghcr.io/jikan-me/jikan-rest:${{ github.sha }}
jikanme/jikan-rest:latest
jikanme/jikan-rest:${{ github.sha }}

View File

@ -1,5 +1,7 @@
FROM jikanme/jikan-rest-php:8.1
ARG BASE_IMAGE_VERSION="8.1"
FROM jikanme/jikan-rest-php:${BASE_IMAGE_VERSION}
ARG GITHUB_PERSONAL_TOKEN
LABEL org.opencontainers.image.source=https://github.com/jikan-me/jikan-rest
RUN set -ex \
&& apt-get update && apt-get install -y --no-install-recommends \
openssl \