From 35a21e8ec2a3da1a6cb14d3393d6b530c0804f89 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sat, 23 Oct 2021 16:16:55 +0200 Subject: [PATCH] feat: build base image for rh8 (#2) Co-authored-by: Robert Kaussow Co-committed-by: Robert Kaussow --- .drone.jsonnet | 180 ++++++++++++++++++++ .drone.yml | 322 ++++++++++++++++++++--------------- Dockerfile => Dockerfile.rh7 | 8 +- Dockerfile.rh8 | 54 ++++++ README.md | 4 +- renovate.json | 4 + 6 files changed, 433 insertions(+), 139 deletions(-) create mode 100644 .drone.jsonnet rename Dockerfile => Dockerfile.rh7 (91%) create mode 100644 Dockerfile.rh8 create mode 100644 renovate.json diff --git a/.drone.jsonnet b/.drone.jsonnet new file mode 100644 index 0000000..090f0c2 --- /dev/null +++ b/.drone.jsonnet @@ -0,0 +1,180 @@ +local PipelineTest = { + kind: 'pipeline', + name: 'test', + platform: { + os: 'linux', + arch: 'amd64', + }, + steps: [ + { + name: 'markdownlint', + image: 'thegeeklab/markdownlint-cli', + commands: [ + "markdownlint 'README.md'", + ], + }, + ], + trigger: { + ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'], + }, +}; + +local PipelineBuildContainer(version='7') = { + kind: 'pipeline', + name: 'build-container-rh' + version, + platform: { + os: 'linux', + arch: 'amd64', + }, + steps: [ + { + name: 'dryrun', + image: 'thegeeklab/drone-docker-buildx:20', + pull: 'always', + settings: { + dry_run: true, + dockerfile: 'Dockerfile.rh' + version, + repo: 'thegeeklab/${DRONE_REPO_NAME}', + }, + when: { + ref: ['refs/pull/**'], + }, + }, + { + name: 'publish-dockerhub', + image: 'thegeeklab/drone-docker-buildx:20', + pull: 'always', + settings: { + dockerfile: 'Dockerfile.rh' + version, + repo: 'thegeeklab/${DRONE_REPO_NAME}', + username: { from_secret: 'docker_username' }, + password: { from_secret: 'docker_password' }, + }, + when: { + ref: ['refs/heads/main', 'refs/tags/**'], + }, + }, + { + name: 'publish-quay', + image: 'thegeeklab/drone-docker-buildx:20', + pull: 'always', + settings: { + dockerfile: 'Dockerfile.rh' + version, + registry: 'quay.io', + repo: 'quay.io/thegeeklab/${DRONE_REPO_NAME}', + username: { from_secret: 'quay_username' }, + password: { from_secret: 'quay_password' }, + tags: version, + }, + when: { + ref: ['refs/heads/main', 'refs/tags/**'], + }, + }, + ], + depends_on: [ + 'test', + ], + trigger: { + ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'], + }, +}; + +local PipelineNotifications = { + kind: 'pipeline', + name: 'notifications', + platform: { + os: 'linux', + arch: 'amd64', + }, + steps: [ + { + image: 'plugins/manifest', + name: 'manifest-dockerhub', + settings: { + ignore_missing: true, + username: { from_secret: 'docker_username' }, + password: { from_secret: 'docker_password' }, + spec: 'manifest.tmpl', + }, + when: { + status: ['success'], + }, + }, + { + image: 'plugins/manifest', + name: 'manifest-quay', + settings: { + ignore_missing: true, + username: { from_secret: 'quay_username' }, + password: { from_secret: 'quay_password' }, + spec: 'manifest-quay.tmpl', + }, + when: { + status: ['success'], + }, + }, + { + name: 'pushrm-dockerhub', + pull: 'always', + image: 'chko/docker-pushrm:1', + environment: { + DOCKER_PASS: { + from_secret: 'docker_password', + }, + DOCKER_USER: { + from_secret: 'docker_username', + }, + PUSHRM_FILE: 'README.md', + PUSHRM_SHORT: 'Rootless Alpine base image', + PUSHRM_TARGET: 'thegeeklab/${DRONE_REPO_NAME}', + }, + when: { + status: ['success'], + }, + }, + { + name: 'pushrm-quay', + pull: 'always', + image: 'chko/docker-pushrm:1', + environment: { + APIKEY__QUAY_IO: { + from_secret: 'quay_token', + }, + PUSHRM_FILE: 'README.md', + PUSHRM_TARGET: 'quay.io/thegeeklab/${DRONE_REPO_NAME}', + }, + when: { + status: ['success'], + }, + }, + { + name: 'matrix', + image: 'thegeeklab/drone-matrix', + settings: { + homeserver: { from_secret: 'matrix_homeserver' }, + roomid: { from_secret: 'matrix_roomid' }, + template: 'Status: **{{ build.Status }}**
Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.Link }}){{#if build.Branch}} ({{ build.Branch }}){{/if}} by {{ commit.Author }}
Message: {{ commit.Message.Title }}', + username: { from_secret: 'matrix_username' }, + password: { from_secret: 'matrix_password' }, + }, + when: { + status: ['success', 'failure'], + }, + }, + ], + depends_on: [ + 'build-container-rh7', + 'build-container-rh8', + ], + trigger: { + ref: ['refs/heads/main', 'refs/tags/**'], + status: ['success', 'failure'], + }, +}; + +[ + PipelineTest, + PipelineBuildContainer(version='7'), + PipelineBuildContainer(version='8'), + PipelineNotifications, +] diff --git a/.drone.yml b/.drone.yml index 14aa611..c680ce6 100644 --- a/.drone.yml +++ b/.drone.yml @@ -7,111 +7,138 @@ platform: arch: amd64 steps: -- name: markdownlint - image: thegeeklab/markdownlint-cli - commands: - - markdownlint 'README.md' + - name: markdownlint + image: thegeeklab/markdownlint-cli + commands: + - markdownlint 'README.md' trigger: ref: - - refs/heads/main - - refs/pull/** - - refs/tags/** + - refs/heads/main + - refs/tags/** + - refs/pull/** --- kind: pipeline -name: build-container +name: build-container-rh7 platform: os: linux arch: amd64 steps: -- name: dryrun - image: thegeeklab/drone-docker-buildx:20 - settings: - dockerfile: Dockerfile - dry_run: true - password: - from_secret: docker_password - repo: thegeeklab/${DRONE_REPO_NAME} - username: - from_secret: docker_username - when: - ref: - - refs/pull/** + - name: dryrun + pull: always + image: thegeeklab/drone-docker-buildx:20 + settings: + dockerfile: Dockerfile.rh7 + dry_run: true + repo: thegeeklab/${DRONE_REPO_NAME} + when: + ref: + - refs/pull/** + + - name: publish-dockerhub + pull: always + image: thegeeklab/drone-docker-buildx:20 + settings: + dockerfile: Dockerfile.rh7 + password: + from_secret: docker_password + repo: thegeeklab/${DRONE_REPO_NAME} + username: + from_secret: docker_username + when: + ref: + - refs/heads/main + - refs/tags/** + + - name: publish-quay + pull: always + image: thegeeklab/drone-docker-buildx:20 + settings: + dockerfile: Dockerfile.rh7 + password: + from_secret: quay_password + registry: quay.io + repo: quay.io/thegeeklab/${DRONE_REPO_NAME} + tags: 7 + username: + from_secret: quay_username + when: + ref: + - refs/heads/main + - refs/tags/** -- name: tags - image: thegeeklab/docker-autotag - environment: - DOCKER_AUTOTAG_FORCE_LATEST: True - DOCKER_AUTOTAG_IGNORE_PRERELEASE: True - DOCKER_AUTOTAG_OUTPUT_FILE: .tags - DOCKER_AUTOTAG_VERSION: ${DRONE_TAG} - when: - ref: - - refs/heads/main - - refs/tags/** - depends_on: - - dryrun - -- name: publish-dockerhub - image: thegeeklab/drone-docker-buildx:20 - settings: - dockerfile: Dockerfile - password: - from_secret: docker_password - repo: thegeeklab/${DRONE_REPO_NAME} - username: - from_secret: docker_username - when: - ref: - - refs/heads/main - - refs/tags/** - depends_on: - - tags - -- name: publish-quay - image: thegeeklab/drone-docker-buildx:20 - settings: - dockerfile: Dockerfile - password: - from_secret: quay_password - registry: quay.io - repo: quay.io/thegeeklab/${DRONE_REPO_NAME} - username: - from_secret: quay_username - when: - ref: +trigger: + ref: - refs/heads/main - refs/tags/** - depends_on: - - tags - -- name: publish-gitea - image: plugins/gitea-release - settings: - api_key: - from_secret: gitea_token - base_url: https://gitea.rknet.org - note: CHANGELOG.md - overwrite: true - title: ${DRONE_TAG} - when: - ref: - - refs/tags/** - depends_on: - - publish-dockerhub - - publish-quay + - refs/pull/** + +depends_on: + - test + +--- +kind: pipeline +name: build-container-rh8 + +platform: + os: linux + arch: amd64 + +steps: + - name: dryrun + pull: always + image: thegeeklab/drone-docker-buildx:20 + settings: + dockerfile: Dockerfile.rh8 + dry_run: true + repo: thegeeklab/${DRONE_REPO_NAME} + when: + ref: + - refs/pull/** + + - name: publish-dockerhub + pull: always + image: thegeeklab/drone-docker-buildx:20 + settings: + dockerfile: Dockerfile.rh8 + password: + from_secret: docker_password + repo: thegeeklab/${DRONE_REPO_NAME} + username: + from_secret: docker_username + when: + ref: + - refs/heads/main + - refs/tags/** + + - name: publish-quay + pull: always + image: thegeeklab/drone-docker-buildx:20 + settings: + dockerfile: Dockerfile.rh8 + password: + from_secret: quay_password + registry: quay.io + repo: quay.io/thegeeklab/${DRONE_REPO_NAME} + tags: 8 + username: + from_secret: quay_username + when: + ref: + - refs/heads/main + - refs/tags/** trigger: ref: - - refs/heads/main - - refs/pull/** - - refs/tags/** + - refs/heads/main + - refs/tags/** + - refs/pull/** depends_on: -- test + - test --- kind: pipeline @@ -122,63 +149,90 @@ platform: arch: amd64 steps: -- name: pushrm-dockerhub - pull: always - image: chko/docker-pushrm:1 - environment: - DOCKER_PASS: - from_secret: docker_password - DOCKER_USER: - from_secret: docker_username - PUSHRM_FILE: README.md - PUSHRM_SHORT: CentOS 7 image to build RPM packages - PUSHRM_TARGET: thegeeklab/${DRONE_REPO_NAME} - when: - status: - - success - -- name: pushrm-quay - pull: always - image: chko/docker-pushrm:1 - environment: - APIKEY__QUAY_IO: - from_secret: quay_token - PUSHRM_FILE: README.md - PUSHRM_TARGET: quay.io/thegeeklab/${DRONE_REPO_NAME} - when: - status: - - success - -- name: matrix - image: plugins/matrix - settings: - homeserver: - from_secret: matrix_homeserver - password: - from_secret: matrix_password - roomid: - from_secret: matrix_roomid - template: "Status: **{{ build.status }}**
Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}
Message: {{ build.message }}" - username: - from_secret: matrix_username - when: - status: - - success - - failure + - name: manifest-dockerhub + image: plugins/manifest + settings: + ignore_missing: true + password: + from_secret: docker_password + spec: manifest.tmpl + username: + from_secret: docker_username + when: + status: + - success + + - name: manifest-quay + image: plugins/manifest + settings: + ignore_missing: true + password: + from_secret: quay_password + spec: manifest-quay.tmpl + username: + from_secret: quay_username + when: + status: + - success + + - name: pushrm-dockerhub + pull: always + image: chko/docker-pushrm:1 + environment: + DOCKER_PASS: + from_secret: docker_password + DOCKER_USER: + from_secret: docker_username + PUSHRM_FILE: README.md + PUSHRM_SHORT: Rootless Alpine base image + PUSHRM_TARGET: thegeeklab/${DRONE_REPO_NAME} + when: + status: + - success + + - name: pushrm-quay + pull: always + image: chko/docker-pushrm:1 + environment: + APIKEY__QUAY_IO: + from_secret: quay_token + PUSHRM_FILE: README.md + PUSHRM_TARGET: quay.io/thegeeklab/${DRONE_REPO_NAME} + when: + status: + - success + + - name: matrix + image: thegeeklab/drone-matrix + settings: + homeserver: + from_secret: matrix_homeserver + password: + from_secret: matrix_password + roomid: + from_secret: matrix_roomid + template: "Status: **{{ build.Status }}**
Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.Link }}){{#if build.Branch}} ({{ build.Branch }}){{/if}} by {{ commit.Author }}
Message: {{ commit.Message.Title }}" + username: + from_secret: matrix_username + when: + status: + - success + - failure trigger: ref: - - refs/heads/main - - refs/tags/** + - refs/heads/main + - refs/tags/** status: - - success - - failure + - success + - failure depends_on: -- build-container + - build-container-rh7 + - build-container-rh8 --- kind: signature -hmac: f3a932f626d5aab6054e52d4419f9b6eacd25e52dec3ab9a9f0335acd5433e73 +hmac: 474bbbb50ad73c8e3fb3c9047caabeefaf91f311582963e508503405b652af5d ... diff --git a/Dockerfile b/Dockerfile.rh7 similarity index 91% rename from Dockerfile rename to Dockerfile.rh7 index db2c091..cf136cd 100644 --- a/Dockerfile +++ b/Dockerfile.rh7 @@ -9,6 +9,10 @@ LABEL org.opencontainers.image.documentation="https://gitea.rknet.org/docker/rpm ENV RPMBUILD_BASE_DIR=/drone/src +RUN yum install -q -y \ + epel-release \ + yum-utils && \ + rpm --import https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7 RUN yum install -q -y \ dash \ ca-certificates \ @@ -38,9 +42,7 @@ RUN yum install -q -y \ pkgconfig \ wget curl \ automake autoconf \ - yum-utils rpm-build rpmdevtools \ - epel-release && \ - rpm --import https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7 && \ + rpm-build rpmdevtools && \ yum clean all ADD overlay/ / diff --git a/Dockerfile.rh8 b/Dockerfile.rh8 new file mode 100644 index 0000000..511c489 --- /dev/null +++ b/Dockerfile.rh8 @@ -0,0 +1,54 @@ +FROM rockylinux/rockylinux:8 + +LABEL maintainer="Robert Kaussow " +LABEL org.opencontainers.image.authors="Robert Kaussow " +LABEL org.opencontainers.image.title="rpmbuild" +LABEL org.opencontainers.image.url="https://gitea.rknet.org/docker/rpmbuild" +LABEL org.opencontainers.image.source="https://gitea.rknet.org/docker/rpmbuild" +LABEL org.opencontainers.image.documentation="https://gitea.rknet.org/docker/rpmbuild" + +ENV RPMBUILD_BASE_DIR=/drone/src + +RUN dnf install -q -y \ + epel-release \ + dnf-utils dnf-plugins-core && \ + rpm --import https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7 && \ + dnf config-manager --set-enabled powertools +RUN dnf install -q -y \ + dash \ + ca-certificates \ + gcc gcc-c++ \ + gnutls \ + gnutls-devel \ + libtool libtool-ltdl \ + pam-devel \ + dbus-devel \ + avahi-devel \ + systemd-devel \ + make cmake \ + git \ + bzip2 \ + bzip2-devel \ + freetype-devel \ + fribidi-devel \ + expat-devel \ + gperf \ + nasm \ + perl \ + python3 \ + yasm \ + which \ + libva-devel \ + zlib-devel \ + pkgconfig \ + wget curl \ + automake autoconf \ + rpm-build rpmdevtools && \ + dnf clean all + +ADD overlay/ / + +USER root + +WORKDIR ${RPMBUILD_BASE_DIR} +CMD [] diff --git a/README.md b/README.md index 85bfdfa..c15b518 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # rpmbuild -CentOS 7 image to build RPM packages +Base image to build RPM packages [![Build Status](https://img.shields.io/drone/build/docker/rpmbuild?logo=drone&server=https%3A%2F%2Fdrone.rknet.org)](https://drone.rknet.org/docker/rpmbuild) [![Docker Hub](https://img.shields.io/badge/dockerhub-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/thegeeklab/rpmbuild) @@ -8,7 +8,7 @@ CentOS 7 image to build RPM packages [![Source: Gitea](https://img.shields.io/badge/source-gitea-blue.svg?logo=gitea&logoColor=white)](https://gitea.rknet.org/docker/rpmbuild) [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://gitea.rknet.org/docker/rpmbuild/src/branch/main/LICENSE) -Simple Docker image based on CentOS 7 to build RPM packages. +Simple Docker images based on CentOS 7/Rocky Linux 8 to build RPM packages. ## Environment variables diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..5f02575 --- /dev/null +++ b/renovate.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": ["github>thegeeklab/renovate-presets:docker"] +}