Skip to content

Commit

Permalink
Migrate centos-7 to ubuntu 20.04
Browse files Browse the repository at this point in the history
Signed-off-by: Eval EXEC <[email protected]>
  • Loading branch information
eval-exec committed Nov 19, 2024
1 parent dde5a2a commit 1ec09de
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 42 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
matrix:
include:
- distro: centos-7
- distro: ubuntu-20.04
platform: linux/amd64
- distro: bionic
platform: linux/amd64
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
strategy:
matrix:
include:
- distro: centos-7
- distro: ubuntu-20.04
platform: linux/amd64
- distro: bionic
platform: linux/amd64
Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
strategy:
matrix:
include:
- distro: centos-7
- distro: ubuntu-20.04
platform: linux/amd64
- distro: bionic
platform: linux/amd64
Expand Down
26 changes: 13 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,46 @@ IMAGE_VERSION := ${RUST_VERSION}
bionic/Dockerfile: gen-dockerfiles templates/bionic.Dockerfile
python3 gen-dockerfiles

centos-7/Dockerfile: gen-dockerfiles templates/centos-7.Dockerfile
ubuntu-20.04/Dockerfile: gen-dockerfiles templates/ubuntu-20.04.Dockerfile
python3 gen-dockerfiles

aarch64/Dockerfile: gen-dockerfiles templates/aarch64.Dockerfile
python3 gen-dockerfiles

build-all: build-bionic build-centos-7 build-aarch64
build-all: build-bionic build-ubuntu-20.04 build-aarch64

build-bionic: bionic/Dockerfile
docker build -f bionic/Dockerfile --tag ${DOCKERHUB_REPO}:bionic-${IMAGE_VERSION} .

build-centos-7: centos-7/Dockerfile
docker build -f centos-7/Dockerfile --tag ${DOCKERHUB_REPO}:centos-7-${IMAGE_VERSION} .
build-ubuntu-20.04: ubuntu-20.04/Dockerfile
docker build -f ubuntu-20.04/Dockerfile --tag ${DOCKERHUB_REPO}:ubuntu-20.04-${IMAGE_VERSION} .

build-aarch64: aarch64/Dockerfile
docker build -f aarch64/Dockerfile --tag ${DOCKERHUB_REPO}:aarch64-${IMAGE_VERSION} .

.PHONY: build-all build-bionic build-centos-7 build-aarch64
push-all: push-bionic push-centos-7 push-aarch64
.PHONY: build-all build-bionic build-ubuntu-20.04 build-aarch64
push-all: push-bionic push-ubuntu-20.04 push-aarch64

push-bionic: build-bionic
docker push ${DOCKERHUB_REPO}:bionic-${IMAGE_VERSION}

push-centos-7: build-centos-7
docker push ${DOCKERHUB_REPO}:centos-7-${IMAGE_VERSION}
push-ubuntu-20.04: build-ubuntu-20.04
docker push ${DOCKERHUB_REPO}:ubuntu-20.04-${IMAGE_VERSION}

push-aarch64: build-aarch64
docker push ${DOCKERHUB_REPO}:aarch64-${IMAGE_VERSION}

.PHONY: push-all push-bionic push-centos-7 push-aarch64
.PHONY: push-all push-bionic push-ubuntu-20.04 push-aarch64

test-all: test-bionic test-centos-7
test-all: test-bionic test-ubuntu-20.04

sync-ckb:
if [ -d ckb ]; then git -C ckb pull; else git clone --depth 1 https://github.com/nervosnetwork/ckb.git; fi

test-bionic: sync-ckb
docker run --rm -it -w /ckb -v "$$(pwd)/ckb:/ckb" ${DOCKERHUB_REPO}:bionic-${IMAGE_VERSION} make prod

test-centos-7: sync-ckb
docker run --rm -it -w /ckb -v "$$(pwd)/ckb:/ckb" ${DOCKERHUB_REPO}:centos-7-${IMAGE_VERSION} make prod
test-ubuntu-20.04: sync-ckb
docker run --rm -it -w /ckb -v "$$(pwd)/ckb:/ckb" ${DOCKERHUB_REPO}:ubuntu-20.04-${IMAGE_VERSION} make prod

.PHONY: test-all test-bionic test-centos-7 sync-ckb
.PHONY: test-all test-bionic test-ubuntu-20.04 sync-ckb
4 changes: 2 additions & 2 deletions gen-dockerfiles
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ RUSTUP_VERSION = '1.27.1'
DISTRIBUTIONS = {
# Ubuntu
'bionic': 'x86_64-unknown-linux-gnu',
# CentOS
'centos-7': 'x86_64-unknown-linux-gnu',
# Ubuntu
'ubuntu-20.04': 'x86_64-unknown-linux-gnu',
# Arch64
'aarch64': 'aarch64-unknown-linux-gnu',
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
FROM centos:7
FROM ubuntu:20.04

ENV PATH=/root/.cargo/bin:$PATH

RUN set -eux; \
sed -i 's/mirror.centos.org/vault.centos.org/g' /etc/yum.repos.d/CentOS-*.repo; \
sed -i 's/^#.*baseurl=http/baseurl=http/g' /etc/yum.repos.d/CentOS-*.repo; \
sed -i 's/^mirrorlist=http/#mirrorlist=http/g' /etc/yum.repos.d/CentOS-*.repo; \
yum install -y centos-release-scl; \
sed -i 's/mirror.centos.org/vault.centos.org/g' /etc/yum.repos.d/CentOS-*.repo; \
sed -i 's/^#.*baseurl=http/baseurl=http/g' /etc/yum.repos.d/CentOS-*.repo; \
sed -i 's/^mirrorlist=http/#mirrorlist=http/g' /etc/yum.repos.d/CentOS-*.repo; \
yum install -y git curl make devtoolset-8 llvm-toolset-7 perl-core pcre-devel wget zlib-devel; \
yum clean all; \
rm -rf /var/cache/yum
apt update; \
apt install -y git curl build-essential llvm perl-core pcre-devel wget zlib-devel; \
apt clean all; \
rm -rf /var/cache/apt

ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
Expand Down Expand Up @@ -40,7 +34,7 @@ RUN set -eux; \
RUN git config --global --add safe.directory /ckb
RUN git config --global --add safe.directory /ckb-cli

COPY centos-7/entrypoint.sh /
COPY ubuntu-20.04/entrypoint.sh /

ENTRYPOINT ["/entrypoint.sh"]
CMD ["bash"]
18 changes: 6 additions & 12 deletions centos-7/Dockerfile → ubuntu-20.04/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
FROM centos:7
FROM ubuntu:20.04

ENV PATH=/root/.cargo/bin:$PATH

RUN set -eux; \
sed -i 's/mirror.centos.org/vault.centos.org/g' /etc/yum.repos.d/CentOS-*.repo; \
sed -i 's/^#.*baseurl=http/baseurl=http/g' /etc/yum.repos.d/CentOS-*.repo; \
sed -i 's/^mirrorlist=http/#mirrorlist=http/g' /etc/yum.repos.d/CentOS-*.repo; \
yum install -y centos-release-scl; \
sed -i 's/mirror.centos.org/vault.centos.org/g' /etc/yum.repos.d/CentOS-*.repo; \
sed -i 's/^#.*baseurl=http/baseurl=http/g' /etc/yum.repos.d/CentOS-*.repo; \
sed -i 's/^mirrorlist=http/#mirrorlist=http/g' /etc/yum.repos.d/CentOS-*.repo; \
yum install -y git curl make devtoolset-8 llvm-toolset-7 perl-core pcre-devel wget zlib-devel; \
yum clean all; \
rm -rf /var/cache/yum
apt update; \
apt install -y git curl build-essential llvm perl-core pcre-devel wget zlib-devel; \
apt clean all; \
rm -rf /var/cache/apt

ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
Expand Down Expand Up @@ -40,7 +34,7 @@ RUN set -eux; \
RUN git config --global --add safe.directory /ckb
RUN git config --global --add safe.directory /ckb-cli

COPY centos-7/entrypoint.sh /
COPY ubuntu-20.04/entrypoint.sh /

ENTRYPOINT ["/entrypoint.sh"]
CMD ["bash"]
File renamed without changes.

0 comments on commit 1ec09de

Please sign in to comment.