Attempt to build and publish an image on ghcr.io

This commit is contained in:
Laurent Indermuehle 2023-01-20 09:32:59 +01:00
parent 6bc293a022
commit a849f92e2e
No known key found for this signature in database
GPG key ID: 93FA944C9F34DD09
2 changed files with 125 additions and 0 deletions

View file

@ -0,0 +1,104 @@
---
name: Docker Image CI mariadb103-py38-mysqlclient201
on:
push:
branch:
- main
- lie_tests_using_containers
paths:
- 'test-containers/mariadb103-py38-mysqlclient201/**'
env:
REGISTRY: ghcr.io
IMAGE_NAME: mariadb103-py38-mysqlclient201
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
# - name: Build the Docker image
# run: docker build . --file Dockerfile --tag mariadb103-py38-mysqlclient201:$(date +%s)
# # Install the cosign tool
# # https://github.com/sigstore/cosign-installer
# - name: Install cosign
# uses: sigstore/cosign-installer@f3c664df7af409cb4873aa5068053ba9d61a57b6 #v2.6.0
# with:
# cosign-release: 'v1.11.0'
# Login against a Docker registry
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Build and push Docker image with Buildx
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
with:
context: .
push: ${{ github.event_name == 'push' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
# # Sign the resulting Docker image digest.
# # This will only write to the public Rekor transparency log when the Docker
# # repository is public to avoid leaking data. If you would like to publish
# # transparency data even for private images, pass --force to cosign below.
# # https://github.com/sigstore/cosign
# - name: Sign the published Docker image
# env:
# COSIGN_EXPERIMENTAL: "true"
# # This step uses the identity token to provision an ephemeral certificate
# # against the sigstore community Fulcio instance.
# run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }}
# mariadb103-py38-mysqlclient201
# mariadb103-py38-pymysql093
# mariadb103-py39-mysqlclient203
# mariadb103-py39-pymysql093
# mariadb106-py310-mysqlclient211
# mariadb106-py310-pymysql093
# mariadb106-py310-pymysql102
# my57-py38-mysqlclient201
# my57-py38-pymysql0711
# my57-py38-pymysql093
# my80-py310-mysqlclient211
# my80-py310-pymysql093
# my80-py310-pymysql102
# my80-py38-mysqlclient201
# my80-py38-pymysql0711
# my80-py38-pymysql093
# my80-py39-mysqlclient203
# my80-py39-pymysql0711
# my80-py39-pymysql093

View file

@ -0,0 +1,21 @@
FROM quay.io/ansible/ubuntu2004-test-container:main
# ubuntu2004 comes with mariadb-client-10.3
# iproute2 # To grab docker network gateway address
# python3.8-dev # Reqs for mysqlclient
# default-libmysqlclient-dev # Reqs for mysqlclient
# build-essential # Reqs for mysqlclient
RUN apt update -y && \
DEBIAN_FRONTEND=noninteractive apt upgrade -y --no-install-recommends && \
DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends \
python3.8 \
python3.8-dev \
mariadb-client \
iproute2 \
default-libmysqlclient-dev \
build-essential
RUN python3.8 -m pip install --disable-pip-version-check --no-cache-dir mysqlclient==2.0.1
ENV container=docker
CMD ["/sbin/init"]