init
Some checks failed
build docker container / build-py310 (push) Failing after 3m43s
build docker container / build-py311 (push) Failing after 3m48s
build docker container / build-py39 (push) Successful in 9m28s
build docker container / build-py38 (push) Successful in 11m9s

This commit is contained in:
Ivan Schaller 2023-08-14 11:02:39 +02:00
commit bcc4ac9e4f
Signed by: olofvndrhr
GPG key ID: 2A6BE07D99C8C205
7 changed files with 365 additions and 0 deletions

View file

@ -0,0 +1,238 @@
name: build docker container
run-name: ${{ gitea.actor }}
on:
push:
tags:
- "v*.*.*"
pull_request:
branches: [main, master]
env:
REGISTRY: git.44net.ch
jobs:
build-py38:
runs-on: ubuntu-latest
env:
IMAGE_NAME: actions/runner-python38
steps:
- name: checkout code
uses: actions/checkout@v3
- name: setup qemu
uses: docker/setup-qemu-action@v2
- name: setup docker buildx
uses: docker/setup-buildx-action@v2
- name: get container metadata
uses: docker/metadata-action@v4
id: metadata
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=auto
prefix=
suffix=
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: login to container registry
uses: docker/login-action@v2
if: gitea.event_name != 'pull_request'
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.CR_USERNAME }}
password: ${{ secrets.CR_PASSWORD }}
- name: build and push docker image @amd64+arm64
uses: docker/build-push-action@v4
with:
push: ${{ gitea.event_name != 'pull_request' }}
platforms: |
linux/amd64
linux/arm64
context: .
file: Dockerfile.py38
provenance: false
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
build-args: |
BUILD_VERSION=${{ steps.metadata.outputs.version }}
BUILD_COMMIT=${{ gitea.sha }}
build-py39:
runs-on: ubuntu-latest
env:
IMAGE_NAME: actions/runner-python39
steps:
- name: checkout code
uses: actions/checkout@v3
- name: setup qemu
uses: docker/setup-qemu-action@v2
- name: setup docker buildx
uses: docker/setup-buildx-action@v2
- name: get container metadata
uses: docker/metadata-action@v4
id: metadata
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=auto
prefix=
suffix=
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: login to container registry
uses: docker/login-action@v2
if: gitea.event_name != 'pull_request'
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.CR_USERNAME }}
password: ${{ secrets.CR_PASSWORD }}
- name: build and push docker image @amd64+arm64
uses: docker/build-push-action@v4
with:
push: ${{ gitea.event_name != 'pull_request' }}
platforms: |
linux/amd64
linux/arm64
context: .
file: Dockerfile.py39
provenance: false
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
build-args: |
BUILD_VERSION=${{ steps.metadata.outputs.version }}
BUILD_COMMIT=${{ gitea.sha }}
build-py310:
runs-on: ubuntu-latest
env:
IMAGE_NAME: actions/runner-python310
steps:
- name: checkout code
uses: actions/checkout@v3
- name: setup qemu
uses: docker/setup-qemu-action@v2
- name: setup docker buildx
uses: docker/setup-buildx-action@v2
- name: get container metadata
uses: docker/metadata-action@v4
id: metadata
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=auto
prefix=
suffix=
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: login to container registry
uses: docker/login-action@v2
if: gitea.event_name != 'pull_request'
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.CR_USERNAME }}
password: ${{ secrets.CR_PASSWORD }}
- name: build and push docker image @amd64+arm64
uses: docker/build-push-action@v4
with:
push: ${{ gitea.event_name != 'pull_request' }}
platforms: |
linux/amd64
linux/arm64
context: .
file: Dockerfile.py310
provenance: false
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
build-args: |
BUILD_VERSION=${{ steps.metadata.outputs.version }}
BUILD_COMMIT=${{ gitea.sha }}
build-py311:
runs-on: ubuntu-latest
env:
IMAGE_NAME: actions/runner-python311
steps:
- name: checkout code
uses: actions/checkout@v3
- name: setup qemu
uses: docker/setup-qemu-action@v2
- name: setup docker buildx
uses: docker/setup-buildx-action@v2
- name: get container metadata
uses: docker/metadata-action@v4
id: metadata
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=auto
prefix=
suffix=
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: login to container registry
uses: docker/login-action@v2
if: gitea.event_name != 'pull_request'
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.CR_USERNAME }}
password: ${{ secrets.CR_PASSWORD }}
- name: build and push docker image @amd64+arm64
uses: docker/build-push-action@v4
with:
push: ${{ gitea.event_name != 'pull_request' }}
platforms: |
linux/amd64
linux/arm64
context: .
file: Dockerfile.py311
provenance: false
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
build-args: |
BUILD_VERSION=${{ steps.metadata.outputs.version }}
BUILD_COMMIT=${{ gitea.sha }}

0
.gitignore vendored Normal file
View file

28
Dockerfile.py310 Normal file
View file

@ -0,0 +1,28 @@
FROM catthehacker/ubuntu:runner-22.04
ENV PATH /usr/local/bin:$PATH
ENV PYVERSION="3.10"
RUN \
echo "*** installing python ${PYVERSION} ***" \
&& sudo apt install -y software-properties-common wget \
&& sudo add-apt-repository -y ppa:deadsnakes/ppa \
&& sudo apt update \
&& sudo apt remove -y python3* \
&& sudo apt install -y "python${PYVERSION}" "python${PYVERSION}-full" "python${PYVERSION}-dev" \
&& sudo ln -s /usr/bin/python${PYVERSION} /usr/bin/python \
&& sudo ln -s /usr/bin/python${PYVERSION} /usr/bin/python3 \
&& wget -q https://bootstrap.pypa.io/get-pip.py \
&& sudo python3 get-pip.py \
&& python3 -m pip install --upgrade pip wheel setuptools
# cleanup installation
RUN \
echo "**** cleanup ****" \
&& sudo apt-get purge --auto-remove -y \
&& sudo apt-get clean \
&& sudo rm -rf \
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/*

28
Dockerfile.py311 Normal file
View file

@ -0,0 +1,28 @@
FROM catthehacker/ubuntu:runner-22.04
ENV PATH /usr/local/bin:$PATH
ENV PYVERSION="3.11"
RUN \
echo "*** installing python ${PYVERSION} ***" \
&& sudo apt install -y software-properties-common wget \
&& sudo add-apt-repository -y ppa:deadsnakes/ppa \
&& sudo apt update \
&& sudo apt remove -y python3* \
&& sudo apt install -y "python${PYVERSION}" "python${PYVERSION}-full" "python${PYVERSION}-dev" \
&& sudo ln -s /usr/bin/python${PYVERSION} /usr/bin/python \
&& sudo ln -s /usr/bin/python${PYVERSION} /usr/bin/python3 \
&& wget -q https://bootstrap.pypa.io/get-pip.py \
&& sudo python3 get-pip.py \
&& python3 -m pip install --upgrade pip wheel setuptools
# cleanup installation
RUN \
echo "**** cleanup ****" \
&& sudo apt-get purge --auto-remove -y \
&& sudo apt-get clean \
&& sudo rm -rf \
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/*

28
Dockerfile.py38 Normal file
View file

@ -0,0 +1,28 @@
FROM catthehacker/ubuntu:runner-22.04
ENV PATH /usr/local/bin:$PATH
ENV PYVERSION="3.8"
RUN \
echo "*** installing python ${PYVERSION} ***" \
&& sudo apt install -y software-properties-common wget \
&& sudo add-apt-repository -y ppa:deadsnakes/ppa \
&& sudo apt update \
&& sudo apt remove -y python3* \
&& sudo apt install -y "python${PYVERSION}" "python${PYVERSION}-full" "python${PYVERSION}-dev" \
&& sudo ln -s /usr/bin/python${PYVERSION} /usr/bin/python \
&& sudo ln -s /usr/bin/python${PYVERSION} /usr/bin/python3 \
&& wget -q https://bootstrap.pypa.io/get-pip.py \
&& sudo python3 get-pip.py \
&& python3 -m pip install --upgrade pip wheel setuptools
# cleanup installation
RUN \
echo "**** cleanup ****" \
&& sudo apt-get purge --auto-remove -y \
&& sudo apt-get clean \
&& sudo rm -rf \
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/*

28
Dockerfile.py39 Normal file
View file

@ -0,0 +1,28 @@
FROM catthehacker/ubuntu:runner-22.04
ENV PATH /usr/local/bin:$PATH
ENV PYVERSION="3.9"
RUN \
echo "*** installing python ${PYVERSION} ***" \
&& sudo apt install -y software-properties-common wget \
&& sudo add-apt-repository -y ppa:deadsnakes/ppa \
&& sudo apt update \
&& sudo apt remove -y python3* \
&& sudo apt install -y "python${PYVERSION}" "python${PYVERSION}-full" "python${PYVERSION}-dev" \
&& sudo ln -s /usr/bin/python${PYVERSION} /usr/bin/python \
&& sudo ln -s /usr/bin/python${PYVERSION} /usr/bin/python3 \
&& wget -q https://bootstrap.pypa.io/get-pip.py \
&& sudo python3 get-pip.py \
&& python3 -m pip install --upgrade pip wheel setuptools
# cleanup installation
RUN \
echo "**** cleanup ****" \
&& sudo apt-get purge --auto-remove -y \
&& sudo apt-get clean \
&& sudo rm -rf \
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/*

15
README.md Normal file
View file

@ -0,0 +1,15 @@
# gitea actions image for python
based on `catthehacker/ubuntu:runner-22.04`
### available images
`git.44net.ch/actions/runner-python38`
`git.44net.ch/actions/runner-python39`
`git.44net.ch/actions/runner-python310`
`git.44net.ch/actions/runner-python311`
### installed tools:
- python
- pip