mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/boypt/openssh-rpms.git
synced 2026-09-20 08:03:38 +08:00
refactor(docker): simplify images, move el8 to centos-stream, isolate el5, fix altarch/metalink
This commit is contained in:
6
.github/workflows/build-images.yml
vendored
6
.github/workflows/build-images.yml
vendored
@@ -31,7 +31,7 @@ jobs:
|
|||||||
VERSION_NUM=7
|
VERSION_NUM=7
|
||||||
MIRROR=0
|
MIRROR=0
|
||||||
- tag_suffix: el8
|
- tag_suffix: el8
|
||||||
dockerfile: ./docker/Dockerfile.centos
|
dockerfile: ./docker/Dockerfile.centos-stream
|
||||||
build_args: |
|
build_args: |
|
||||||
VERSION_NUM=8
|
VERSION_NUM=8
|
||||||
MIRROR=0
|
MIRROR=0
|
||||||
@@ -55,7 +55,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Replace Mirror URL
|
- name: Replace Mirror URL
|
||||||
run: |
|
run: |
|
||||||
sed -i 's|mirrors.\+\.cn|mirror.centos.org|g' ./docker/*
|
sed -i -E 's|mirrors\.[^/]+|mirror.centos.org|g' ./docker/*
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v4
|
uses: docker/setup-buildx-action@v4
|
||||||
@@ -111,7 +111,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Replace Mirror URL
|
- name: Replace Mirror URL
|
||||||
run: |
|
run: |
|
||||||
sed -i 's|mirrors.\+\.cn|mirror.centos.org|g' ./docker/*
|
sed -i -E 's|mirrors\.[^/]+|mirror.centos.org|g' ./docker/*
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v4
|
uses: docker/setup-qemu-action@v4
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
ARG VERSION_NUM="2023"
|
|
||||||
FROM amazonlinux:$VERSION_NUM
|
|
||||||
ARG VERSION_NUM
|
|
||||||
ARG MIRROR=0
|
|
||||||
LABEL Author="Rex Zhou <zrx879582094@gmail.com>"
|
|
||||||
|
|
||||||
WORKDIR /data
|
|
||||||
|
|
||||||
# Copy all files
|
|
||||||
COPY . /data
|
|
||||||
|
|
||||||
RUN export MIRROR="$MIRROR" && \
|
|
||||||
bash ./docker/modify_yum_source.sh && \
|
|
||||||
if [ "$VERSION_NUM" = "2023" ]; then \
|
|
||||||
yum makecache timer && yum install -y libnsl systemd-devel; \
|
|
||||||
elif [ "$VERSION_NUM" = "2" ]; then \
|
|
||||||
yum makecache fast && yum install -y gtk2-devel systemd-devel; \
|
|
||||||
elif [ "$VERSION_NUM" = "1" ]; then \
|
|
||||||
yum makecache fast \
|
|
||||||
fi && \
|
|
||||||
yum install -y wget autoconf automake gcc make rpm-build openssl-devel pam-devel krb5-devel zlib-devel libXt-devel libX11-devel perl perl-IPC-Cmd perl-Time-Piece && \
|
|
||||||
yum clean all
|
|
||||||
|
|
||||||
CMD ["./docker/docker_compile.sh"]
|
|
||||||
@@ -11,16 +11,10 @@ COPY ./docker/ /data/docker/
|
|||||||
|
|
||||||
RUN export MIRROR="$MIRROR" && \
|
RUN export MIRROR="$MIRROR" && \
|
||||||
bash ./docker/modify_yum_source.sh && \
|
bash ./docker/modify_yum_source.sh && \
|
||||||
if [ "$VERSION_NUM" = "8" ]; then \
|
if [ "$VERSION_NUM" = "7" ]; then \
|
||||||
yum install -y perl perl-IPC-Cmd perl-Time-Piece systemd-devel openssl-devel && \
|
|
||||||
yum install -y 'dnf-command(config-manager)' && \
|
|
||||||
yum config-manager --set-enabled powertools; \
|
|
||||||
elif [ "$VERSION_NUM" = "7" ]; then \
|
|
||||||
yum install -y systemd-devel perl perl-IPC-Cmd perl-Time-Piece ;\
|
yum install -y systemd-devel perl perl-IPC-Cmd perl-Time-Piece ;\
|
||||||
elif [ "$VERSION_NUM" = "6" ]; then \
|
elif [ "$VERSION_NUM" = "6" ]; then \
|
||||||
yum install -y util-linux-ng perl perl-IPC-Cmd perl-Time-Piece ;\
|
yum install -y util-linux-ng perl perl-IPC-Cmd perl-Time-Piece ;\
|
||||||
elif [ "$VERSION_NUM" = "5" ]; then \
|
|
||||||
yum install -y gcc44; \
|
|
||||||
fi && \
|
fi && \
|
||||||
yum install -y wget autoconf automake gcc make rpm-build pam-devel krb5-devel zlib-devel libXt-devel libX11-devel gtk2-devel e2fsprogs-devel && \
|
yum install -y wget autoconf automake gcc make rpm-build pam-devel krb5-devel zlib-devel libXt-devel libX11-devel gtk2-devel e2fsprogs-devel && \
|
||||||
yum clean all && \
|
yum clean all && \
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
# Official: https://hub.docker.com/r/openeuler/openeuler
|
|
||||||
ARG VERSION_NUM="24.03"
|
|
||||||
FROM openeuler/openeuler:$VERSION_NUM
|
|
||||||
ARG VERSION_NUM
|
|
||||||
ARG MIRROR=0
|
|
||||||
LABEL Author="Rex Zhou <zrx879582094@gmail.com>"
|
|
||||||
|
|
||||||
WORKDIR /data
|
|
||||||
|
|
||||||
# Copy all files
|
|
||||||
COPY . /data
|
|
||||||
|
|
||||||
# Official webpage: https://www.openeuler.openatom.cn/zh/blog/2024-10-15-boostYum/2024-10-15-boostYum.html
|
|
||||||
RUN if [ "$MIRROR" != "0" ]; then \
|
|
||||||
MIRROR_URL="mirrors.163.com/openeuler" && \
|
|
||||||
sed -i.bak \
|
|
||||||
"s|repo.openeuler.org|$MIRROR_URL|g;s|^metalink|#metalink|g" \
|
|
||||||
/etc/yum.repos.d/openEuler.repo; \
|
|
||||||
else \
|
|
||||||
MIRROR_URL="mirrors.ocf.berkeley.edu/openeuler" && \
|
|
||||||
sed -i.bak \
|
|
||||||
"s|repo.openeuler.org|$MIRROR_URL|g;s|^metalink|#metalink|g" \
|
|
||||||
/etc/yum.repos.d/openEuler.repo; \
|
|
||||||
fi && \
|
|
||||||
if [[ "$VERSION_NUM" == 20* ]]; then sed -i \
|
|
||||||
"s|gpgcheck=1|gpgcheck=0|g" /etc/yum.repos.d/openEuler.repo; \
|
|
||||||
fi && \
|
|
||||||
rm -rf /var/cache/yum/ && \
|
|
||||||
yum clean all && yum makecache timer && \
|
|
||||||
yum install -y autoconf automake gcc make rpm-build pam-devel krb5-devel zlib-devel systemd-devel openssl-devel \
|
|
||||||
perl perl-IPC-Cmd perl-Time-Piece wget && \
|
|
||||||
yum clean all
|
|
||||||
|
|
||||||
CMD ["./docker/docker_compile.sh"]
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
# Official: https://hub.docker.com/_/rockylinux
|
|
||||||
ARG VERSION_NUM="9"
|
|
||||||
FROM rockylinux:$VERSION_NUM
|
|
||||||
ARG VERSION_NUM
|
|
||||||
ARG MIRROR=0
|
|
||||||
LABEL Author="Rex Zhou <zrx879582094@gmail.com>"
|
|
||||||
|
|
||||||
WORKDIR /data
|
|
||||||
|
|
||||||
# Copy all files
|
|
||||||
COPY . /data
|
|
||||||
|
|
||||||
# Official webpage: https://developer.aliyun.com/mirror/rockylinux
|
|
||||||
RUN if [ "$MIRROR" != "0" ]; then \
|
|
||||||
MIRROR_URL="https://mirrors.aliyun.com/rockylinux" && \
|
|
||||||
sed -e 's|^mirrorlist=|#mirrorlist=|g' \
|
|
||||||
-e "s|^#baseurl=http://dl.rockylinux.org/\$contentdir|baseurl=$MIRROR_URL|g" \
|
|
||||||
-i.bak \
|
|
||||||
/etc/yum.repos.d/*.repo; \
|
|
||||||
else \
|
|
||||||
MIRROR_URL="https://mirrors.ocf.berkeley.edu/rocky" && \
|
|
||||||
sed -e 's|^mirrorlist=|#mirrorlist=|g' \
|
|
||||||
-e "s|^#baseurl=http://dl.rockylinux.org/\$contentdir|baseurl=$MIRROR_URL|g" \
|
|
||||||
-i.bak \
|
|
||||||
/etc/yum.repos.d/*.repo; \
|
|
||||||
fi && \
|
|
||||||
rm -rf /var/cache/yum/ && \
|
|
||||||
yum clean all && yum makecache timer && \
|
|
||||||
yum install -y wget autoconf automake gcc perl make rpm-build pam-devel krb5-devel zlib-devel libXt-devel libX11-devel gtk2-devel systemd-devel openssl-devel && \
|
|
||||||
yum clean all
|
|
||||||
|
|
||||||
CMD ["./docker/docker_compile.sh"]
|
|
||||||
@@ -69,7 +69,7 @@ docker run --rm -v .:/data -e "UOS20=1" elssh:el7
|
|||||||
#### For EL8 (CentOS 8 / RHEL 8 / Rocky 8 / AlmaLinux 8)
|
#### For EL8 (CentOS 8 / RHEL 8 / Rocky 8 / AlmaLinux 8)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker build -t elssh:el8 -f ./docker/Dockerfile.centos --build-arg VERSION_NUM=8 --build-arg MIRROR=0 .
|
docker build -t elssh:el8 -f ./docker/Dockerfile.centos-stream --build-arg VERSION_NUM=8 --build-arg MIRROR=0 .
|
||||||
docker run --rm -v .:/data elssh:el8
|
docker run --rm -v .:/data elssh:el8
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -115,6 +115,8 @@ docker run --rm -v .:/data --platform linux/arm64 elssh_aarch64:el9
|
|||||||
| `M32` (EL5 only) | 0 or 1 | `0` = 64-bit, `1` = 32-bit |
|
| `M32` (EL5 only) | 0 or 1 | `0` = 64-bit, `1` = 32-bit |
|
||||||
| `UOS20` | 0 or 1 | `1` = build the UOS 20 variant (EL7 image); enables the kernel-panic patch and prefixes `PKGREL` with `uos20.` |
|
| `UOS20` | 0 or 1 | `1` = build the UOS 20 variant (EL7 image); enables the kernel-panic patch and prefixes `PKGREL` with `uos20.` |
|
||||||
|
|
||||||
|
> Note: Amazon Linux / openEuler / Rocky Linux 的独立 Dockerfile 已合并至通用 EL 镜像(通过 glibc 兼容复用 EL8/EL9),不再单独维护。
|
||||||
|
|
||||||
**Example for users in China:**
|
**Example for users in China:**
|
||||||
|
|
||||||
Add `--build-arg MIRROR=1` to the `docker build` command.
|
Add `--build-arg MIRROR=1` to the `docker build` command.
|
||||||
@@ -151,7 +153,7 @@ Each subdirectory contains the generated `.rpm` files (including debuginfo if av
|
|||||||
```bash
|
```bash
|
||||||
env ALL=1 ./pullsrc.sh
|
env ALL=1 ./pullsrc.sh
|
||||||
|
|
||||||
docker build -t elssh:el8 -f ./docker/Dockerfile.centos --build-arg VERSION_NUM=8 --build-arg MIRROR=0 .
|
docker build -t elssh:el8 -f ./docker/Dockerfile.centos-stream --build-arg VERSION_NUM=8 --build-arg MIRROR=0 .
|
||||||
docker run --rm -v .:/data elssh:el8
|
docker run --rm -v .:/data elssh:el8
|
||||||
|
|
||||||
docker build -t elssh:el9 -f ./docker/Dockerfile.centos-stream --build-arg VERSION_NUM=9 --build-arg MIRROR=0 .
|
docker build -t elssh:el9 -f ./docker/Dockerfile.centos-stream --build-arg VERSION_NUM=9 --build-arg MIRROR=0 .
|
||||||
|
|||||||
@@ -1,102 +1,94 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# Mirror switching for CentOS 5/6/7 yum repositories.
|
||||||
# Author: Rex Chow
|
# Set MIRROR=0 to use official mirrors, otherwise use Chinese mirrors (default).
|
||||||
# Modified: 2024-07-08 09:29:45
|
|
||||||
# Description: This script will modify yum repositories to Tsinghua University mirror.
|
|
||||||
# Copyright: Copyright © 2024 Rex Zhou. All rights reserved.
|
|
||||||
|
|
||||||
RELEASE_VER=$(rpm --eval '%{?dist}')
|
RELEASE_VER=$(rpm --eval '%{?dist}')
|
||||||
[ -z "$RELEASE_VER" ] && RELEASE_VER=".el5"
|
[ -z "$RELEASE_VER" ] && RELEASE_VER=".el5"
|
||||||
|
|
||||||
# Cent OS 5 is NOT support modern SSL protocol, so use plain HTTP protocol.
|
# aarch64 builds use the altarch (CentOS AltArch) vault tree
|
||||||
|
ALTARCH=""
|
||||||
|
[ "$(uname -m)" = "aarch64" ] && ALTARCH="/altarch"
|
||||||
|
|
||||||
|
# CentOS 5 does not support HTTPS, always use archive.kernel.org over HTTP
|
||||||
if [ "$RELEASE_VER" != ".el5" ]; then
|
if [ "$RELEASE_VER" != ".el5" ]; then
|
||||||
if [ "$MIRROR" != "0" ]; then
|
if [ "$MIRROR" != "0" ]; then
|
||||||
# Using USTC mirror, which is much useful for Chinese users.
|
CENTOS_MIRROR="https://mirrors.ustc.edu.cn/centos-vault"
|
||||||
MIRROR_URL="https://mirrors.ustc.edu.cn/centos-vault";
|
EPEL_MIRROR="http://mirrors.aliyun.com/epel-archive"
|
||||||
AWS_DOMAIN="amazonaws.com.cn"
|
else
|
||||||
AWS_REGION="cn-northwest-1"
|
CENTOS_MIRROR="https://archive.kernel.org/centos-vault"
|
||||||
else
|
EPEL_MIRROR="http://archives.fedoraproject.org/pub/archive/epel"
|
||||||
# Default mirror, the official mirror link.
|
fi
|
||||||
MIRROR_URL="https://vault.centos.org/";
|
|
||||||
AWS_DOMAIN="amazonaws.com"
|
|
||||||
AWS_REGION="us-east-2"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
MIRROR_URL="http://mirrors.huaweicloud.com"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For ARM platform, the mirror url needs a suffix `altarch`
|
|
||||||
if [ "$(uname -m)" = "aarch64" ]; then
|
|
||||||
OS_KEY="altarch"
|
|
||||||
if [ "$RELEASE_VER" != ".el8" ]; then
|
|
||||||
MIRROR_URL="$MIRROR_URL/$OS_KEY";
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
OS_KEY="centos"
|
if [ "$MIRROR" != "0" ]; then
|
||||||
|
CENTOS_MIRROR="http://archive.kernel.org/centos-vault"
|
||||||
|
EPEL_MIRROR="http://mirrors.aliyun.com/epel-archive"
|
||||||
|
else
|
||||||
|
CENTOS_MIRROR="http://archive.kernel.org/centos-vault"
|
||||||
|
EPEL_MIRROR="http://archives.fedoraproject.org/pub/archive/epel"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
function modify_el8() {
|
disable_fastestmirror() {
|
||||||
sed -e "s|^mirrorlist=|#mirrorlist=|g" \
|
sed -e 's|enabled=1|enabled=0|' -i /etc/yum/pluginconf.d/fastestmirror.conf 2>/dev/null || true
|
||||||
-e "s|^#baseurl=http://mirror.centos.org/\$contentdir/\$releasever|baseurl=${MIRROR_URL}/8.5.2111|g" \
|
|
||||||
-i.bak /etc/yum.repos.d/CentOS-*.repo && \
|
|
||||||
rm -rf /var/cache/yum/ && \
|
|
||||||
yum makecache timer
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function modify_el7() {
|
modify_el7() {
|
||||||
sed -e 's|^mirrorlist=|#mirrorlist=|g' \
|
disable_fastestmirror
|
||||||
-e "s@^#baseurl=http://mirror.centos.org/$OS_KEY/\$releasever@baseurl=${MIRROR_URL}/7.9.2009@g" \
|
sed -e '/^mirrorlist=/s|^|#|g' \
|
||||||
-e "s|^#baseurl=http://mirror.centos.org/\$contentdir/\$releasever|baseurl=${MIRROR_URL}/7.9.2009|g" \
|
-e "s|^#baseurl=http://mirror.centos.org/centos/\$releasever/|baseurl=${CENTOS_MIRROR}${ALTARCH}/7.9.2009/|g" \
|
||||||
-i.bak /etc/yum.repos.d/CentOS-*.repo && \
|
-i.bak /etc/yum.repos.d/CentOS-*.repo
|
||||||
rm -rf /var/cache/yum/ && \
|
yum install -y epel-release
|
||||||
yum makecache fast
|
sed -e '/^mirrorlist=/s|^|#|g' \
|
||||||
|
-e 's|^metalink|#metalink|' \
|
||||||
|
-e "s|^#baseurl=http://download.fedoraproject.org/pub/epel/7/|baseurl=${EPEL_MIRROR}/7/|g" \
|
||||||
|
-i.bak /etc/yum.repos.d/epel*.repo
|
||||||
|
rm -rf /var/cache/yum/
|
||||||
|
yum makecache fast
|
||||||
}
|
}
|
||||||
|
|
||||||
function modify_el6() {
|
modify_el6() {
|
||||||
sed -e "s|^mirrorlist=|#mirrorlist=|g" \
|
disable_fastestmirror
|
||||||
-e "s|^#baseurl=http://mirror.centos.org/$OS_KEY/\$releasever|baseurl=${MIRROR_URL}/6.10|g" \
|
sed -e "s|^mirrorlist=|#mirrorlist=|g" \
|
||||||
-e "s|^#baseurl=http://mirror.centos.org/\$contentdir/\$releasever|baseurl=${MIRROR_URL}/6.10|g" \
|
-e "s|^#baseurl=http://mirror.centos.org/centos/\$releasever|baseurl=${CENTOS_MIRROR}/6.10|g" \
|
||||||
-i.bak /etc/yum.repos.d/CentOS-*.repo && \
|
-e "s|^#baseurl=http://mirror.centos.org/\$contentdir/\$releasever|baseurl=${CENTOS_MIRROR}/6.10|g" \
|
||||||
rm -rf /var/cache/yum/ && \
|
-i.bak /etc/yum.repos.d/CentOS-*.repo
|
||||||
yum makecache fast
|
yum install -y epel-release centos-release-scl-rh centos-release-scl
|
||||||
|
sed -e "s|^mirrorlist=|#mirrorlist=|g" \
|
||||||
|
-e 's|^metalink|#metalink|' \
|
||||||
|
-e "s|^# *baseurl=http://mirror.centos.org/centos/6/sclo|baseurl=${CENTOS_MIRROR}/6.10/sclo|g" \
|
||||||
|
-e "s|^#baseurl=http://download.fedoraproject.org/pub/epel/6/|baseurl=${EPEL_MIRROR}/6/|g" \
|
||||||
|
-i.bak /etc/yum.repos.d/epel*.repo /etc/yum.repos.d/*scl*.repo
|
||||||
|
rm -rf /var/cache/yum/
|
||||||
|
yum makecache fast
|
||||||
}
|
}
|
||||||
|
|
||||||
function modify_el5() {
|
modify_el5() {
|
||||||
sed -e "s|^mirrorlist=|#mirrorlist=|g" \
|
disable_fastestmirror
|
||||||
-e "s|^#baseurl=http://mirror.centos.org/centos/\$releasever|baseurl=${MIRROR_URL}/centos-vault/5.11|g" \
|
sed -e "s|^mirrorlist=|#mirrorlist=|g" \
|
||||||
-e "s|^#baseurl=http://mirror.centos.org/\$contentdir/\$releasever|baseurl=${MIRROR_URL}/centos-vault/5.11|g" \
|
-e "s|^#baseurl=http://mirror.centos.org/centos/\$releasever|baseurl=${CENTOS_MIRROR}/5.11|g" \
|
||||||
-i.bak /etc/yum.repos.d/*.repo && \
|
-e "s|^#baseurl=http://mirror.centos.org/\$contentdir/\$releasever|baseurl=${CENTOS_MIRROR}/5.11|g" \
|
||||||
rm -rf /var/cache/yum/ && \
|
-i.bak /etc/yum.repos.d/*.repo
|
||||||
yum makecache fast
|
yum install -y epel-release
|
||||||
|
sed -e "/^mirrorlist/s|^|#|g" \
|
||||||
|
-e 's|^metalink|#metalink|' \
|
||||||
|
-e "s|^#baseurl=.\+\$|baseurl=${EPEL_MIRROR}/5/\$basearch|g" \
|
||||||
|
-i.bak /etc/yum.repos.d/epel*.repo
|
||||||
|
rm -rf /var/cache/yum/
|
||||||
|
yum makecache
|
||||||
}
|
}
|
||||||
|
|
||||||
case $RELEASE_VER in
|
case $RELEASE_VER in
|
||||||
.el8)
|
.el7)
|
||||||
modify_el8
|
modify_el7
|
||||||
;;
|
;;
|
||||||
.el7)
|
.el6)
|
||||||
modify_el7
|
modify_el6
|
||||||
;;
|
;;
|
||||||
.el6)
|
.el5)
|
||||||
modify_el6
|
modify_el5
|
||||||
;;
|
;;
|
||||||
.el5)
|
*)
|
||||||
modify_el5
|
echo "Unsupported dist: $RELEASE_VER, expected el5/el6/el7"
|
||||||
;;
|
exit 1
|
||||||
.amzn1)
|
;;
|
||||||
echo "$AWS_DOMAIN" > /etc/yum/vars/awsdomain
|
esac
|
||||||
echo "$AWS_REGION" > /etc/yum/vars/awsregion
|
|
||||||
;;
|
|
||||||
.amzn2)
|
|
||||||
echo "$AWS_DOMAIN" > /etc/yum/vars/awsdomain
|
|
||||||
echo "$AWS_REGION" > /etc/yum/vars/awsregion
|
|
||||||
;;
|
|
||||||
.amzn2023)
|
|
||||||
echo "$AWS_DOMAIN" > /etc/dnf/vars/awsdomain
|
|
||||||
echo "$AWS_REGION" > /etc/dnf/vars/awsregion
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "rpm dist undefined, please specify: el5 el6 el7"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
Reference in New Issue
Block a user