Skip to content

wip: add gha for images #7

wip: add gha for images

wip: add gha for images #7

Workflow file for this run

name: Publish Docker Images
on:
push:
branches: [ "add-gha-docker-images" ]
workflow_dispatch:
env:
IMG_VERSION: "1.0"
GRPCIO_IMAGE_VERSION: "1.0.0"
PSYCOPG_VERSION: "3.1"
IMAGE_REGISTRY: "vayan"
jobs:
alpy_base:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.8.18", "3.9.18", "3.10.13", "3.11.8", "3.12.2" ]
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Set config variable env
run: |
ALPY_VERSION=`echo ${{ matrix.python-version }} | cut -d. -f1,2`
echo "ALPY_VERSION=$ALPY_VERSION" >> $GITHUB_ENV
echo "HASH_VERSION=${{ hashFiles('requirements.txt', 'docker/alpy/base.Dockerfile') }}" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: docker/alpy/base.Dockerfile
network: host
no-cache: true
push: true
build-args: |
PYTHON_VERSION=${{ matrix.python-version }}
tags: |
${{ env.IMAGE_REGISTRY }}/grpcio-alpy${{ env.ALPY_VERSION }}-base:${{ env.GRPCIO_IMAGE_VERSION }}-${{ env.HASH_VERSION }}
${{ env.IMAGE_REGISTRY }}/grpcio-alpy${{ env.ALPY_VERSION }}-base:latest
alpy:
runs-on: ubuntu-latest
needs: [ alpy_base ]
strategy:
matrix:
alpy-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Set config variable env
run: |
echo "IMG_FULL=${{ env.IMAGE_REGISTRY }}/protoplasm:${{ env.IMG_VERSION }}-alpy${{ matrix.alpy-version }}" >> $GITHUB_ENV
echo "HASH_VERSION=${{ hashFiles('requirements.txt', 'docker/alpy/base.Dockerfile') }}" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: docker/alpy/Dockerfile
network: host
no-cache: true
push: true
build-args: |
PACKAGE_VERSION=${{ env.IMG_VERSION }}
BASE_IMAGE=${{ env.IMAGE_REGISTRY }}/grpcio-alpy${{ matrix.alpy-version }}-base:${{ env.GRPCIO_IMAGE_VERSION }}-${{ env.HASH_VERSION }}
tags: |
${{ env.IMG_FULL }}
${{ env.IMAGE_REGISTRY }}/protoplasm:latest-alpy${{ env.ALPY_VERSION }}
alpy_psycopg:
runs-on: ubuntu-latest
needs: [ alpy_base ]
strategy:
matrix:
alpy-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Set config variable env
run: |
echo "IMG_FULL=${{ env.IMAGE_REGISTRY }}/protoplasm:${{ env.IMG_VERSION }}-alpy${{ matrix.alpy-version }}-psycopg${{ env.PSYCOPG_VERSION }}" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: docker/alpy/psycopg.Dockerfile
network: host
no-cache: true
push: true
build-args: |
BASE_IMAGE=${{ env.IMAGE_REGISTRY }}/protoplasm:${{ env.IMG_VERSION }}-alpy${{ matrix.alpy-version }}
PSYCOPG_VERSION=${{ env.PSYCOPG_VERSION }}
tags: |
${{ env.IMG_FULL }}
# add others