Skip to content

⬆️ Update dependency grpcio to v1.65.0 #75

⬆️ Update dependency grpcio to v1.65.0

⬆️ Update dependency grpcio to v1.65.0 #75

name: build-and-push
on:
push:
branches:
- master
paths:
- Dockerfile
- requirements.txt
pull_request:
paths:
- Dockerfile
- requirements.txt
workflow_dispatch:
jobs:
docker:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
alpine-version: ["3.15", "3.16", "3.17", "3.18"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
env:
IMAGE_NAME: rushilsrivastava/python-grpcio-alpine
outputs:
image-tags: ${{ env.IMAGE_NAME }}:${{ steps.docker_meta.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Get grpcio version
id: grpcio-version
run: |
GRPCIO_VERSION=$(cat requirements.txt | cut -d'=' -f 3)
echo "::set-output name=version::$GRPCIO_VERSION"
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ matrix.python-version }}-${{ matrix.alpine-version }}-${{ steps.grpcio-version.outputs.version }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push (pr)
if: ${{ github.event_name == 'pull_request' }}
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
build-args: |
PYTHON_VERSION=${{ matrix.python-version }}
ALPINE_VERSION=${{ matrix.alpine-version }}
tags: ${{ env.IMAGE_NAME }}:${{ github.sha }}
cache-from: type=gha, scope=${{ github.workflow }}
cache-to: type=gha, scope=${{ github.workflow }}
outputs: type=docker,dest=/tmp/python-alpine-grpcio-${{ matrix.python-version }}-${{ matrix.alpine-version }}-${{ steps.grpcio-version.outputs.version }}-${{ github.sha }}.tar
- name: Upload artifact (pr)
if: ${{ github.event_name == 'pull_request' }}
uses: actions/upload-artifact@v3
with:
name: docker-image-${{ matrix.python-version }}-${{ matrix.alpine-version }}-${{ steps.grpcio-version.outputs.version }}-${{ github.sha }}
path: /tmp/python-alpine-grpcio-${{ matrix.python-version }}-${{ matrix.alpine-version }}-${{ steps.grpcio-version.outputs.version }}-${{ github.sha }}.tar
retention-days: 1
- name: Build and push (branch)
if: ${{ github.event_name != 'pull_request' }}
uses: docker/build-push-action@v4
with:
context: .
push: true
# platforms: linux/amd64,linux/arm64
build-args: |
PYTHON_VERSION=${{ matrix.python-version }}
ALPINE_VERSION=${{ matrix.alpine-version }}
tags: |
${{ env.IMAGE_NAME }}:${{ matrix.python-version }}-${{ steps.grpcio-version.outputs.version }}-${{ matrix.alpine-version }}
${{ env.IMAGE_NAME }}:${{ matrix.python-version }}-latest-${{ matrix.alpine-version }}
${{ env.IMAGE_NAME }}:${{ matrix.python-version }}-${{ steps.grpcio-version.outputs.version }}-${{ matrix.alpine-version }}-${{ github.sha }}
cache-from: type=gha, scope=${{ github.workflow }}
cache-to: type=gha, scope=${{ github.workflow }}
# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
# - name: Move cache
# if: ${{ github.event_name != 'pull_request' }}
# run: |
# rm -rf /tmp/.buildx-cache
# mv /tmp/.buildx-cache-new /tmp/.buildx-cache