refactor image import and add Alpine docker image

- dynamic import of QR reader
- build docker also for arm64
This commit is contained in:
scito
2022-12-24 01:59:35 +01:00
committed by Roland Kurmann
parent 915efcf192
commit 9d052dc78a
21 changed files with 910 additions and 521 deletions

View File

@@ -4,14 +4,14 @@ on:
push:
pull_request:
schedule:
- cron: '47 3 * * *'
- cron: '37 3 * * *'
jobs:
build:
strategy:
matrix:
python-version: ["3.x", "3.11", "3.10", "3.9", "pypy-3.9", "3.8", "pypy-3.8", "3.7", "pypy-3.7"]
python-version: ["3.x", "3.11", "3.10", "3.9", "3.8", "3.7"]
platform: [ubuntu-latest, macos-latest, windows-latest]
exclude:
- platform: windows-latest
@@ -25,6 +25,14 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install zbar shared lib for QReader (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get install -y libzbar0
- name: Install zbar shared lib for QReader (macOS)
if: runner.os == 'macOS'
run: |
brew install zbar
- name: Install dependencies
run: |
python -m pip install --upgrade pip

76
.github/workflows/ci_docker.yml vendored Normal file
View File

@@ -0,0 +1,76 @@
name: "Docker: build and publish"
# How to setup: https://event-driven.io/en/how_to_buid_and_push_docker_image_with_github_actions/
# How to run: https://aschmelyun.com/blog/using-docker-run-inside-of-github-actions/
on:
# run it on push to the default repository branch
push:
# branches: [master]
# run it during pull request
# pull_request:
jobs:
# define job to build and publish docker image
build-and-push-docker-image:
name: Build Docker image and push to repositories
# run only when code is compiling and tests are passing
runs-on: ubuntu-latest
# steps to perform in job
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
# setup Docker build action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to Github Packages
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_IO_TOKEN }}
- name: "no_qr_reader: Build image and push to Docker Hub and GitHub Container Registry"
uses: docker/build-push-action@v2
with:
# relative path to the place where source code with Dockerfile is located
platforms: linux/amd64,linux/arm64
context: .
file: Dockerfile_no_qr_reader
# Note: tags has to be all lower-case
tags: |
scit0/extract_otp_secret_keys_no_qr_reader:latest
ghcr.io/scito/extract_otp_secret_keys_no_qr_reader:latest
# build on feature branches, push only on master branch
# TODO push: ${{ github.ref == 'refs/heads/master' }}
push: true
- name: "qr_reader: Build image and push to Docker Hub and GitHub Container Registry"
uses: docker/build-push-action@v2
with:
platforms: linux/amd64,linux/arm64
# relative path to the place where source code with Dockerfile is located
context: .
# Note: tags has to be all lower-case
tags: |
scit0/extract_otp_secret_keys:latest
ghcr.io/scito/extract_otp_secret_keys:latest
# build on feature branches, push only on master branch
# TODO push: ${{ github.ref == 'refs/heads/master' }}
push: true
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}