diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 106071f9e42fb7de971fa2910e84d5135588c798..b87372785ca9aeea1cbea630b24f7a7b44b80f53 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -458,7 +458,7 @@ make-archive-knot-dns: <<: *knot-dns-base artifacts: paths: - - knot-dns/pkg/archives/dev + - knot-dns/pkg/ script: - apt update - *setup-project diff --git a/ci/lxc/README.md b/ci/lxc/README.md new file mode 100644 index 0000000000000000000000000000000000000000..4d6b027c3216fee48ee4775ad0d6b7279cc5ba9b --- /dev/null +++ b/ci/lxc/README.md @@ -0,0 +1,47 @@ +# apkg LXC images + +These are per-distro LXC images based on +[lxc-gitlab-runner](https://gitlab.nic.cz/labs/lxc-gitlab-runner) with +packaging deps and latest stable apkg installed. + +Unlike native gitlab docker, LXC can run systemd and these images contain it +so you can + + systemctl start foo + +etc. + +Use those images from your `Dockerfile`: + + FROM registry.nic.cz/packaging/apkg/lxc/debian-11 + +## build image + +use `build.sh` to build docker image, for example: + +``` +./build.sh debian-11 +``` + +## push (upload) image into apkg CI + +you need to **login** first: + +``` +$ docker login registry.nic.cz +``` + +then you can use `push.sh` script: + +``` +./push.sh debian-11 +``` + +## build & push images + +use `update.sh` wrapper to build and push multiple images +using `build.sh` and `push.sh` scripts described above: + +``` +./update.sh debian-10 debian-11 ubuntu-22.04 +``` diff --git a/ci/lxc/build.sh b/ci/lxc/build.sh new file mode 100755 index 0000000000000000000000000000000000000000..bd1ac19536da8bb7d56f06abe88bd94faa3143c9 --- /dev/null +++ b/ci/lxc/build.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# build specified docker image + +IMAGE=$1 + +if [ -z "$IMAGE" ]; then + echo "usage: $0 IMAGE" + exit 1 +fi +set -ex +docker build --no-cache -t "registry.nic.cz/packaging/apkg/lxc/$IMAGE" "$IMAGE" diff --git a/ci/lxc/centos-7/Dockerfile b/ci/lxc/centos-7/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..f9d40a91aea24ef8b492e665ad70fee6ab79f220 --- /dev/null +++ b/ci/lxc/centos-7/Dockerfile @@ -0,0 +1,34 @@ +FROM registry.nic.cz/labs/lxc-gitlab-runner/centos-7 + +WORKDIR /root +CMD ["/bin/bash"] + +# overcome locale issues +RUN yum install -y glibc-common +RUN localedef -i en_US -f UTF-8 C.UTF-8 + +# upgrade system to latest +RUN yum upgrade -y +# enable EPEL +RUN yum install -y epel-release + +# packaging deps +RUN yum install -y \ + git \ + rpm-build \ + python3-setuptools \ + python3-pip +# basic deps +RUN pip3 install \ + beautifulsoup4 \ + blessings \ + cached-property \ + click \ + distro \ + jinja2 \ + packaging \ + requests \ + toml +# install stable apkg from PyPI +RUN python3 -m pip install apkg +RUN apkg --version diff --git a/ci/lxc/debian-10/Dockerfile b/ci/lxc/debian-10/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..290647f6f2f8e483a0b4d5551960c5694bdd7c0a --- /dev/null +++ b/ci/lxc/debian-10/Dockerfile @@ -0,0 +1,37 @@ +FROM registry.nic.cz/labs/lxc-gitlab-runner/debian-10 +ENV DEBIAN_FRONTEND=noninteractive + +WORKDIR /root +CMD ["/bin/bash"] + +# upgrade system to latest +RUN apt-get update -qqq +RUN apt-get upgrade -y -qqq + +# packaging deps +RUN apt-get install -y -qqq \ + apt-utils \ + build-essential \ + curl \ + debhelper \ + dh-python \ + dpkg-dev \ + git \ + python3-all \ + python3-pip \ + python3-setuptools +# apkg deps +RUN apt-get install -y -qqq \ + python3-bs4 \ + python3-blessings \ + python3-click \ + python3-distro \ + python3-jinja2 \ + python3-packaging \ + python3-requests \ + python3-toml +# install py deps unavailable from distro repos +RUN python3 -m pip install build +# install stable apkg from PyPI +RUN python3 -m pip install apkg +RUN apkg --version diff --git a/ci/lxc/debian-11/Dockerfile b/ci/lxc/debian-11/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..a6c49c60758ca518975d0334e4db32bad5b97822 --- /dev/null +++ b/ci/lxc/debian-11/Dockerfile @@ -0,0 +1,36 @@ +FROM registry.nic.cz/labs/lxc-gitlab-runner/debian-11 +ENV DEBIAN_FRONTEND=noninteractive + +WORKDIR /root +CMD ["/bin/bash"] + +# upgrade system to latest +RUN apt-get update -qqq +RUN apt-get upgrade -y -qqq + +# packaging deps +RUN apt-get install -y -qqq \ + apt-utils \ + build-essential \ + curl \ + debhelper \ + dh-python \ + dpkg-dev \ + git \ + python3-all \ + python3-pip \ + python3-setuptools +# apkg deps +RUN apt-get install -y -qqq \ + python3-bs4 \ + python3-blessings \ + python3-build \ + python3-click \ + python3-distro \ + python3-jinja2 \ + python3-packaging \ + python3-requests \ + python3-toml +# install stable apkg from PyPI +RUN python3 -m pip install apkg +RUN apkg --version diff --git a/ci/lxc/fedora-36/Dockerfile b/ci/lxc/fedora-36/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..18f1a42933a88f6c5e7e51f357fff75525fe0cf4 --- /dev/null +++ b/ci/lxc/fedora-36/Dockerfile @@ -0,0 +1,27 @@ +FROM registry.nic.cz/labs/lxc-gitlab-runner/fedora-36 + +WORKDIR /root +CMD ["/bin/bash"] + +# upgrade system to latest +RUN dnf upgrade -y + +# packaging deps +RUN dnf install -y \ + git \ + rpm-build \ + python3-setuptools \ + python3-pip +# basic deps +RUN dnf install -y \ + python3-beautifulsoup4 \ + python3-blessings \ + python3-click \ + python3-distro \ + python3-jinja2 \ + python3-packaging \ + python3-requests \ + python3-toml +# install stable apkg from PyPI +RUN python3 -m pip install apkg +RUN apkg --version diff --git a/ci/lxc/opensuse-15.4/Dockerfile b/ci/lxc/opensuse-15.4/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..43e5c13c43d6f1d8b0ca853a86661425470bd85a --- /dev/null +++ b/ci/lxc/opensuse-15.4/Dockerfile @@ -0,0 +1,20 @@ +FROM registry.nic.cz/labs/lxc-gitlab-runner/opensuse-15.4 +ENV LC_ALL=C.UTF-8 +ENV PATH="~/.local/bin:${PATH}" + +WORKDIR /root +CMD ["/bin/bash"] +SHELL ["/bin/bash", "-c"] + + +# packaging deps +RUN zypper install -y curl git rpm-build python3-pip python3-virtualenv +# basic deps +RUN zypper install -y python3-beautifulsoup4 python3-setuptools python3-Jinja2 python3-click python3-distro python3-blessings python3-requests python3-toml python3-cached-property +# systemd +RUN zypper install -y systemd +# install stable apkg from PyPI +RUN echo 'PATH="~/.local/bin:${PATH}"' >> ~/.bashrc +RUN python3 -m pip install pipx +RUN pipx install apkg +RUN apkg --version diff --git a/ci/lxc/push.sh b/ci/lxc/push.sh new file mode 100755 index 0000000000000000000000000000000000000000..aa3de7ef6d2bc77212455c6fa4315e14763b78d8 --- /dev/null +++ b/ci/lxc/push.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# upload docker image into apkg registry + +IMAGE=$1 + +if [ -z "$IMAGE" ]; then + echo "usage: $0 IMAGE" + exit 1 +fi +set -ex +docker push "registry.nic.cz/packaging/apkg/lxc/$IMAGE" diff --git a/ci/lxc/rocky-8/Dockerfile b/ci/lxc/rocky-8/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..b4c699779bb887c3c99d36a3aa6810b6089dfb7f --- /dev/null +++ b/ci/lxc/rocky-8/Dockerfile @@ -0,0 +1,37 @@ +FROM registry.nic.cz/labs/lxc-gitlab-runner/rocky-8 +ENV LC_ALL=C.UTF-8 + +WORKDIR /root +CMD ["/bin/bash"] + +# upgrade system to latest +RUN dnf upgrade -y +# get dnf plugins +RUN dnf install -y dnf-plugins-core +# enable PowerTools +RUN dnf config-manager --set-enabled powertools +# enable EPEL +RUN dnf install -y epel-release +# update repos +RUN dnf update -y + +# packaging deps +RUN dnf install -y \ + git \ + rpm-build \ + python3-setuptools \ + python3-pip +# basic deps +RUN pip3 install \ + beautifulsoup4 \ + blessings \ + cached-property \ + click \ + distro \ + jinja2 \ + packaging \ + requests \ + toml +# install stable apkg from PyPI +RUN python3 -m pip install apkg +RUN apkg --version diff --git a/ci/lxc/ubuntu-18.04/Dockerfile b/ci/lxc/ubuntu-18.04/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..0ede0fe9bda64daafb88254a2b77eefd48a5d676 --- /dev/null +++ b/ci/lxc/ubuntu-18.04/Dockerfile @@ -0,0 +1,39 @@ +FROM registry.nic.cz/labs/lxc-gitlab-runner/ubuntu-18.04 +ENV DEBIAN_FRONTEND=noninteractive +ENV LC_ALL=C.UTF-8 + +WORKDIR /root +CMD ["/bin/bash"] + +# upgrade system to latest +RUN apt-get update -qqq +RUN apt-get upgrade -y -qqq + +# packaging deps +RUN apt-get install -y -qqq \ + apt-utils \ + build-essential \ + curl \ + debhelper \ + dh-python \ + dpkg-dev \ + git \ + python3-all \ + python3-pip \ + python3-setuptools +# apkg deps +RUN apt-get install -y -qqq \ + python3-blessings \ + python3-click \ + python3-jinja2 \ + python3-packaging \ + python3-toml +# python deps not available\too old in distro +RUN pip3 install \ + beautifulsoup4 \ + build \ + distro \ + cached_property +# install stable apkg from PyPI +RUN python3 -m pip install apkg +RUN apkg --version diff --git a/ci/lxc/ubuntu-20.04/Dockerfile b/ci/lxc/ubuntu-20.04/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..e486fcad24c1fa5934248691a1f5fae259f8e01f --- /dev/null +++ b/ci/lxc/ubuntu-20.04/Dockerfile @@ -0,0 +1,35 @@ +FROM registry.nic.cz/labs/lxc-gitlab-runner/ubuntu-20.04 +ENV DEBIAN_FRONTEND=noninteractive + +WORKDIR /root +CMD ["/bin/bash"] + +# upgrade system to latest +RUN apt-get update -qqq +RUN apt-get upgrade -y -qqq + +# packaging deps +RUN apt-get install -y -qqq \ + apt-utils \ + build-essential \ + curl \ + debhelper \ + dh-python \ + dpkg-dev \ + git \ + python3-all \ + python3-pip \ + python3-setuptools +# apkg deps +RUN apt-get install -y -qqq \ + python3-bs4 \ + python3-blessings \ + python3-click \ + python3-distro \ + python3-jinja2 \ + python3-packaging \ + python3-requests \ + python3-toml +# install stable apkg from PyPI +RUN python3 -m pip install apkg +RUN apkg --version diff --git a/ci/lxc/ubuntu-22.04/Dockerfile b/ci/lxc/ubuntu-22.04/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..4ba482df98d7e89602b2757e8a6f8a6ff47c7098 --- /dev/null +++ b/ci/lxc/ubuntu-22.04/Dockerfile @@ -0,0 +1,36 @@ +FROM registry.nic.cz/labs/lxc-gitlab-runner/ubuntu-22.04 +ENV DEBIAN_FRONTEND=noninteractive + +WORKDIR /root +CMD ["/bin/bash"] + +# upgrade system to latest +RUN apt-get update -qqq +RUN apt-get upgrade -y -qqq + +# packaging deps +RUN apt-get install -y -qqq \ + apt-utils \ + build-essential \ + curl \ + debhelper \ + dh-python \ + dpkg-dev \ + git \ + python3-all \ + python3-pip \ + python3-setuptools +# apkg deps +RUN apt-get install -y -qqq \ + python3-bs4 \ + python3-blessings \ + python3-build \ + python3-click \ + python3-distro \ + python3-jinja2 \ + python3-packaging \ + python3-requests \ + python3-toml +# install stable apkg from PyPI +RUN python3 -m pip install apkg +RUN apkg --version diff --git a/ci/lxc/update.sh b/ci/lxc/update.sh new file mode 100755 index 0000000000000000000000000000000000000000..3711cfd8d848a1865e09ba61d4a3351878372204 --- /dev/null +++ b/ci/lxc/update.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# build and upload docker image(s) into apkg registry +# +# this is a simple wrapper around build.sh and update.sh +# +# to build & upload all images: ./update.sh */ + +if [[ $# -le 0 ]]; then + echo "usage: $0 IMAGE..." + exit 1 +fi +set -e + +for ARG in "$@" +do + IMAGE=${ARG%/} + echo "Building $IMAGE..." + ./build.sh $IMAGE + echo "Pushing $IMAGE..." + ./push.sh $IMAGE +done +