From 2e8e5ac87143228782345474ec2e976881ed7734 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9=20=D0=91=D0=B0?= =?UTF-8?q?=D0=B4=D1=8F=D0=B5=D0=B2?= Date: Thu, 10 Oct 2024 18:48:49 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B2=D0=B0=D1=8F=20=D0=B2?= =?UTF-8?q?=D0=B5=D1=80=D1=81=D0=B8=D1=8F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/release.yaml | 118 ++++++++++++++++++++++++++++++++++ .vscode/settings.json | 8 +++ README.md | 11 +++- dockerfiles/base.dockerfile | 30 +++++++++ dockerfiles/python.dockerfile | 23 +++++++ etc/default/locale | 1 + etc/environment | 1 + etc/locale.gen | 1 + 8 files changed, 192 insertions(+), 1 deletion(-) create mode 100644 .gitea/workflows/release.yaml create mode 100644 .vscode/settings.json create mode 100644 dockerfiles/base.dockerfile create mode 100644 dockerfiles/python.dockerfile create mode 100644 etc/default/locale create mode 100644 etc/environment create mode 100644 etc/locale.gen diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml new file mode 100644 index 0000000..13d1d2f --- /dev/null +++ b/.gitea/workflows/release.yaml @@ -0,0 +1,118 @@ +name: release + +on: + schedule: + - cron: 0 0 1 * * + push: + branches: + - main + +jobs: + base: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: set-up qemu + uses: docker/setup-qemu-action@v3 + + - name: set-up docker buildx + uses: https://git.mousesoft.ru/ms/gitea-action-docker-setup-buildx@v3 + with: + buildkitd-flags: --debug + + - name: login to docker hub + uses: https://git.mousesoft.ru/ms/gitea-action-docker-login@v3 + with: + username: ${{ secrets.API_USER }} + password: ${{ secrets.API_TOKEN }} + + - name: get meta + id: meta + run: | + echo IMAGE_CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ') | tee -a $GITHUB_OUTPUT + echo IMAGE_VERSION=$(date -u +'v%y.%m.%d') | tee -a $GITHUB_OUTPUT + echo IMAGE_REVISION=$(git rev-parse HEAD) | tee -a $GITHUB_OUTPUT + + - name: build and push base 22.04 + uses: https://git.mousesoft.ru/ms/gitea-action-docker-build-push@v6 + with: + context: . + file: dockerfiles/base.dockerfile + platforms: | + linux/amd64 + linux/arm64 + pull: true + push: true + no-cache: true + build-args: | + BASE_IMAGE_TAG=ubuntu-22.04 + IMAGE_VERSION=${{ steps.meta.outputs.IMAGE_VERSION }} + IMAGE_CREATED=${{ steps.meta.outputs.IMAGE_CREATED }} + IMAGE_REVISION=${{ steps.meta.outputs.IMAGE_REVISION }} + tags: | + git.mousesoft.ru/ms/gitea-runner-images:ubuntu-22.04 + git.mousesoft.ru/ms/gitea-runner-images:ubuntu-22.04-${{ steps.meta.outputs.IMAGE_VERSION }} + git.mousesoft.ru/ms/gitea-runner-images:ubuntu-latest + + - name: build and push python 22.04 + uses: https://git.mousesoft.ru/ms/gitea-action-docker-build-push@v6 + with: + context: . + file: dockerfiles/python.dockerfile + platforms: | + linux/amd64 + linux/arm64 + pull: true + push: true + no-cache: true + build-args: | + BASE_IMAGE_TAG=ubuntu-22.04 + IMAGE_VERSION=${{ steps.meta.outputs.IMAGE_VERSION }} + IMAGE_CREATED=${{ steps.meta.outputs.IMAGE_CREATED }} + IMAGE_REVISION=${{ steps.meta.outputs.IMAGE_REVISION }} + tags: | + git.mousesoft.ru/ms/gitea-runner-images:python-ubuntu-22.04 + git.mousesoft.ru/ms/gitea-runner-images:python-ubuntu-22.04-${{ steps.meta.outputs.IMAGE_VERSION }} + git.mousesoft.ru/ms/gitea-runner-images:python-ubuntu-latest + + - name: build and push base 20.04 + uses: https://git.mousesoft.ru/ms/gitea-action-docker-build-push@v6 + with: + context: . + file: dockerfiles/base.dockerfile + platforms: | + linux/amd64 + linux/arm64 + pull: true + push: true + no-cache: true + build-args: | + BASE_IMAGE_TAG=ubuntu-20.04 + IMAGE_VERSION=${{ steps.meta.outputs.IMAGE_VERSION }} + IMAGE_CREATED=${{ steps.meta.outputs.IMAGE_CREATED }} + IMAGE_REVISION=${{ steps.meta.outputs.IMAGE_REVISION }} + tags: | + git.mousesoft.ru/ms/gitea-runner-images:ubuntu-20.04 + git.mousesoft.ru/ms/gitea-runner-images:ubuntu-20.04-${{ steps.meta.outputs.IMAGE_VERSION }} + + - name: build and push python 20.04 + uses: https://git.mousesoft.ru/ms/gitea-action-docker-build-push@v6 + with: + context: . + file: dockerfiles/python.dockerfile + platforms: | + linux/amd64 + linux/arm64 + pull: true + push: true + no-cache: true + build-args: | + BASE_IMAGE_TAG=ubuntu-20.04 + IMAGE_VERSION=${{ steps.meta.outputs.IMAGE_VERSION }} + IMAGE_CREATED=${{ steps.meta.outputs.IMAGE_CREATED }} + IMAGE_REVISION=${{ steps.meta.outputs.IMAGE_REVISION }} + tags: | + git.mousesoft.ru/ms/gitea-runner-images:python-ubuntu-20.04 + git.mousesoft.ru/ms/gitea-runner-images:python-ubuntu-20.04-${{ steps.meta.outputs.IMAGE_VERSION }} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..101567e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,8 @@ +{ + "cSpell.words": [ + "buildkitd", + "buildx", + "dockerfiles", + "gitea" + ] +} \ No newline at end of file diff --git a/README.md b/README.md index 2d26514..1c7444d 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,12 @@ # gitea-runner-images -Сборка docker-образов для Gitea runner. \ No newline at end of file +Сборка docker-образов для Gitea runner. Сборка образов выполняется при изменении +в ветке `main` и первого числа каждого месяца. + +В результате сборки создаются следующие образы +`git.mousesoft.ru/ms/gitea-runner-images` со следующими метками: + +1. `ubuntu-22.04` (псевдоним - `latest`) +2. `python-ubuntu-22.04` (псевдоним - `python-latest`) +3. `ubuntu-20.04` +4. `python-ubuntu-20.04` diff --git a/dockerfiles/base.dockerfile b/dockerfiles/base.dockerfile new file mode 100644 index 0000000..971bb21 --- /dev/null +++ b/dockerfiles/base.dockerfile @@ -0,0 +1,30 @@ +ARG BASE_IMAGE_TAG + +FROM gitea/runner-images:${BASE_IMAGE_TAG} + +ARG IMAGE_CREATED +ARG IMAGE_VERSION +ARG IMAGE_REVISION + +LABEL org.opencontainers.image.created="${IMAGE_CREATED}" \ + org.opencontainers.image.authors="MouseSoft" \ + org.opencontainers.image.url="https://git.mousesoft.ru/ms/gitea-runner-images" \ + org.opencontainers.image.documentation="https://git.mousesoft.ru/ms/gitea-runner-images/src/branch/main/README.md" \ + org.opencontainers.image.source="https://git.mousesoft.ru/ms/gitea-runner-images" \ + org.opencontainers.image.version="${IMAGE_VERSION}" \ + org.opencontainers.image.revision="${IMAGE_REVISION}" \ + org.opencontainers.image.vendor="MouseSoft" \ + org.opencontainers.image.licenses="MIT" \ + org.opencontainers.image.title="MouseSoft Gitea Actions runner images" \ + org.opencontainers.image.description="MouseSoft docker images used by act_runner to run workflows." + +ENV LANG=ru_RU.UTF-8 + +RUN apt-get update && \ + apt-get install -y build-essential debhelper dh-exec dpkg-dev dput-ng \ + fakeroot gawk locales sed && \ + rm -rf /var/lib/apt/lists/* + +COPY --chown=root:root etc /etc + +RUN locale-gen --lang ru diff --git a/dockerfiles/python.dockerfile b/dockerfiles/python.dockerfile new file mode 100644 index 0000000..5c34185 --- /dev/null +++ b/dockerfiles/python.dockerfile @@ -0,0 +1,23 @@ +ARG BASE_IMAGE_TAG + +FROM git.mousesoft.ru/ms/gitea-runner-images:${BASE_IMAGE_TAG} + +ARG IMAGE_CREATED +ARG IMAGE_VERSION +ARG IMAGE_REVISION + +LABEL org.opencontainers.image.created="${IMAGE_CREATED}" \ + org.opencontainers.image.authors="MouseSoft" \ + org.opencontainers.image.url="https://git.mousesoft.ru/ms/gitea-runner-images" \ + org.opencontainers.image.documentation="https://git.mousesoft.ru/ms/gitea-runner-images/src/branch/main/README.md" \ + org.opencontainers.image.source="https://git.mousesoft.ru/ms/gitea-runner-images" \ + org.opencontainers.image.version="${IMAGE_VERSION}" \ + org.opencontainers.image.revision="${IMAGE_REVISION}" \ + org.opencontainers.image.vendor="MouseSoft" \ + org.opencontainers.image.licenses="MIT" \ + org.opencontainers.image.title="MouseSoft Gitea Actions runner images" \ + org.opencontainers.image.description="MouseSoft docker images used by act_runner to run workflows." + +RUN apt-get update && \ + apt-get install -y libvirt-dev python3-all python3-dev python3-setuptools && \ + rm -rf /var/lib/apt/lists/* diff --git a/etc/default/locale b/etc/default/locale new file mode 100644 index 0000000..0bd0468 --- /dev/null +++ b/etc/default/locale @@ -0,0 +1 @@ +ru_RU.UTF-8 diff --git a/etc/environment b/etc/environment new file mode 100644 index 0000000..e623bfa --- /dev/null +++ b/etc/environment @@ -0,0 +1 @@ +LANG="ru_RU.UTF-8" diff --git a/etc/locale.gen b/etc/locale.gen new file mode 100644 index 0000000..bfd704b --- /dev/null +++ b/etc/locale.gen @@ -0,0 +1 @@ +ru_RU.UTF-8 UTF-8