Skip to content

Commit

Permalink
Update script and intro an environment variable to using proxy for Gi…
Browse files Browse the repository at this point in the history
…thub. (#35)

- Add `Dockerfile.rockylinux` to build Rocky Linux images
- Modify `pullsrc.sh`, add an environment variable to using proxy for Github.
- Modify `version.env`, sync environment variable.
- Modify `README.md`, sync doc.
- Modify `.github/workflows/build-images.yml`, sync Rocky Linux image.
  • Loading branch information
ChowRex authored Jan 2, 2025
1 parent 0031ccf commit 87327de
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 4 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/build-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -339,3 +339,83 @@ jobs:
- name: Log out from Docker Hub
run: docker logout

build_and_push_rl9:
# The type of runner that the job will run on
runs-on: ubuntu-latest

env:
CHINA_MIRROR: "0"

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Build and push Rocky Linux 9
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/Dockerfile.rockylinux
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:rockylinux9,${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:rl9
build-args: |
VERSION_NUM=9
- name: Log out from Docker Hub
run: docker logout

build_and_push_rl8:
# The type of runner that the job will run on
runs-on: ubuntu-latest

env:
CHINA_MIRROR: "0"

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Build and push Rocky Linux 8
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/Dockerfile.rockylinux
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:rockylinux8,${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:rl8
build-args: |
VERSION_NUM=8
- name: Log out from Docker Hub
run: docker logout
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ Similar Project: [Backport OpenSSH for Debian / Ubuntu distros](https://github.c
- UnionTech OS Server 20
- openEuler 22.03 (LTS-SP1)
- AnolisOS 7.9/8.6
- Rocky Linux 8/9

## Current Version:

- OpenSSH 9.8p1 (see: [OpenSSH Official](https://www.openssh.com/))
- OpenSSH 9.9p1 (see: [OpenSSH Official](https://www.openssh.com/))
- OpenSSL 3.0.15 / 3.0.9 (FIPS validated, see: [OpenSSL Official](https://www.openssl.org/source/))

The build script reads `version.env` for actual version definitions.
Expand Down Expand Up @@ -113,8 +114,7 @@ MAPPING["centos-stream9"]="el7"
MAPPING["centos-stream8"]="el7"
MAPPING["centos7"]="el7"
MAPPING["centos6"]="el6"
# CentOS 5 is NOT valid.
# MAPPING["centos5"]="el5"
MAPPING["centos5"]="el5"
for VERSION in "${!MAPPING[@]}";
do
Expand Down
31 changes: 31 additions & 0 deletions docker/Dockerfile.rockylinux
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Official: https://hub.docker.com/_/rockylinux
ARG VERSION_NUM="9"
FROM rockylinux:$VERSION_NUM
ARG VERSION_NUM
ARG CHINA_MIRROR=0
LABEL Author="Rex Zhou <zrx879582094@gmail.com>"

WORKDIR /data

# Copy all files
COPY . /data

RUN if [ "$CHINA_MIRROR" != "0" ]; then \
# Official webpage: https://developer.aliyun.com/mirror/rockylinux
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; \
fi && \
rm -rf /var/cache/yum/ && \
yum clean all && yum makecache timer && \
yum groupinstall -y "Development Tools" && \
yum install -y perl rpm-build pam-devel krb5-devel zlib-devel libXt-devel libX11-devel gtk2-devel && \
yum clean all && \
find . -type f -name '.keep' -delete && \
LINE_NO=$(grep -n -- "--define 'skip_x11_askpass 1'" /data/compile.sh | cut -d: -f1) && \
sed -i "$LINE_NO a\--define \"debug_package %{nil}\" \\\\" ./compile.sh && \
bash ./pullsrc.sh

CMD ["bash", "/data/compile.sh"]
2 changes: 1 addition & 1 deletion pullsrc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ source version.env

OPENSSHMIR=https://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable
OPENSSLMIR=https://www.openssl.org/source/
OPENSSLMIR=https://github.com/openssl/openssl/releases/download/openssl-${OPENSSLVER}/
OPENSSLMIR=${GH_PROXY}https://github.com/openssl/openssl/releases/download/openssl-${OPENSSLVER}/
ASKPASSMIR=https://src.fedoraproject.org/repo/pkgs/openssh/x11-ssh-askpass-1.2.4.1.tar.gz/8f2e41f3f7eaa8543a2440454637f3c3
PERLMIR=https://www.cpan.org/src/5.0

Expand Down
4 changes: 4 additions & 0 deletions version.env
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ OPENSSLVER=${OPENSSLSRC%%.tar.gz}
OPENSSLVER=${OPENSSLVER##openssl-}
PERLVER=${PERLSRC%%.tar.gz}
PERLVER=${PERLVER##perl-}

# Github Proxy, this arg is very useful for Chinese users.
# You can try this: https://github.akams.cn/
GH_PROXY=""

0 comments on commit 87327de

Please sign in to comment.