From bcc4ac9e4f825dffed7da13d62617143d4d455b4 Mon Sep 17 00:00:00 2001 From: Ivan Schaller Date: Mon, 14 Aug 2023 11:02:39 +0200 Subject: [PATCH] init --- .gitea/workflows/docker_build.yml | 238 ++++++++++++++++++++++++++++++ .gitignore | 0 Dockerfile.py310 | 28 ++++ Dockerfile.py311 | 28 ++++ Dockerfile.py38 | 28 ++++ Dockerfile.py39 | 28 ++++ README.md | 15 ++ 7 files changed, 365 insertions(+) create mode 100644 .gitea/workflows/docker_build.yml create mode 100644 .gitignore create mode 100644 Dockerfile.py310 create mode 100644 Dockerfile.py311 create mode 100644 Dockerfile.py38 create mode 100644 Dockerfile.py39 create mode 100644 README.md diff --git a/.gitea/workflows/docker_build.yml b/.gitea/workflows/docker_build.yml new file mode 100644 index 0000000..8d3c3f0 --- /dev/null +++ b/.gitea/workflows/docker_build.yml @@ -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 }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/Dockerfile.py310 b/Dockerfile.py310 new file mode 100644 index 0000000..cdb8c48 --- /dev/null +++ b/Dockerfile.py310 @@ -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/* diff --git a/Dockerfile.py311 b/Dockerfile.py311 new file mode 100644 index 0000000..1c639f8 --- /dev/null +++ b/Dockerfile.py311 @@ -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/* diff --git a/Dockerfile.py38 b/Dockerfile.py38 new file mode 100644 index 0000000..d85aeba --- /dev/null +++ b/Dockerfile.py38 @@ -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/* diff --git a/Dockerfile.py39 b/Dockerfile.py39 new file mode 100644 index 0000000..3767621 --- /dev/null +++ b/Dockerfile.py39 @@ -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/* diff --git a/README.md b/README.md new file mode 100644 index 0000000..f9142b6 --- /dev/null +++ b/README.md @@ -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