fixed issue #4884, osbase/osadmin image support amd64/arm64

This commit is contained in:
jianghang.loujh
2023-10-07 21:54:00 +08:00
parent 11f89163c1
commit ed754b5203
17 changed files with 215 additions and 113 deletions

View File

@@ -1,4 +1,5 @@
FROM canal/osbase:v2 FROM canal/osbase:v3-amd64
#FROM canal/osbase:v3-arm64
LABEL agapple (jianghang115@gmail.com) LABEL agapple (jianghang115@gmail.com)
@@ -19,7 +20,7 @@ RUN \
/bin/rm -f /home/admin/canal.deployer-*.tar.gz && \ /bin/rm -f /home/admin/canal.deployer-*.tar.gz && \
tar zxvf /tmp/node_exporter.tar.gz -C /home/admin && \ tar zxvf /tmp/node_exporter.tar.gz -C /home/admin && \
ln -s /home/admin/node_exporter-0.18.1.linux-arm64 /home/admin/node_exporter && \ ln -s /home/admin/node_exporter-1.6.1* /home/admin/node_exporter && \
mkdir -p home/admin/canal-server/logs && \ mkdir -p home/admin/canal-server/logs && \
chmod +x /home/admin/*.sh && \ chmod +x /home/admin/*.sh && \

View File

@@ -1,4 +1,5 @@
FROM canal/osadmin:v1 FROM canal/osadmin:v3-amd64
#FROM canal/osadmin:v3-arm64
MAINTAINER agapple (jianghang115@gmail.com) MAINTAINER agapple (jianghang115@gmail.com)

View File

@@ -1,11 +0,0 @@
FROM canal/osbase:v1
MAINTAINER agapple (jianghang115@gmail.com)
RUN \
groupadd -r mysql && useradd -r -g mysql mysql && \
yum -y install wget mysql-server --nogpgcheck && \
yum clean all && \
true
CMD ["/bin/bash"]

View File

@@ -1,11 +0,0 @@
FROM canal/osbase:v1
MAINTAINER agapple (jianghang115@gmail.com)
env NODE_EPORTER_LINK="https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-arm64.tar.gz"
RUN \
wget "$NODE_EPORTER_LINK" -O /tmp/node_exporter.tar.gz && \
true
CMD ["/bin/bash"]

6
docker/base/README.md Normal file
View File

@@ -0,0 +1,6 @@
# osbase
cd amd64 && docker build --no-cache -t canal/osbase ./ -f Dockerfile
# osadmin
cd amd64 && docker build --no-cache -t canal/osadmin ./ -f ./Dockerfile_admin

View File

@@ -0,0 +1,62 @@
# amd64
FROM centos:centos7.9.2009@sha256:dead07b4d8ed7e29e98de0f4504d87e8880d4347859d839686a31da35a3b532f
# arm64
#FROM centos:centos7.9.2009@sha256:73f11afcbb50d8bc70eab9f0850b3fa30e61a419bc48cf426e63527d14a8373b
ARG jdk_rpm
ARG platform_env
MAINTAINER agapple (jianghang115@gmail.com)
# env DOWNLOAD_AMD_LINK="https://download.oracle.com/otn/java/jdk/8u361-b09/0ae14417abb444ebb02b9815e2103550/jdk-8u361-linux-x64.rpm"
# env DOWNLOAD_ARM_LINK="https://download.oracle.com/otn/java/jdk/8u361-b09/0ae14417abb444ebb02b9815e2103550/jdk-8u361-linux-aarch64.rpm"
env NODE_EPORTER_LINK="https://github.com/prometheus/node_exporter/releases/download/v1.6.1/node_exporter-1.6.1.linux-amd64.tar.gz"
# install system
# update yum config, fix "centos6.x yum install failure && Determining fastest mirrors slow" problems
COPY yum/ /tmp/
RUN \
/bin/cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak && \
/bin/cp -f /tmp/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo && \
/bin/cp /etc/yum/pluginconf.d/fastestmirror.conf /etc/yum/pluginconf.d/fastestmirror.conf.bak && \
awk '{ if($0=="enabled=1"){print "enabled=0";} else{print $0;} }' /etc/yum/pluginconf.d/fastestmirror.conf.bak > /etc/yum/pluginconf.d/fastestmirror.conf && \
/bin/cp /etc/yum.conf /etc/yum.conf.bak && \
echo 'minrate=1' >> /etc/yum.conf && echo 'timeout=600' >> /etc/yum.conf && \
yum clean all && yum makecache
RUN \
/bin/cp -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo 'root:Hello1234' | chpasswd && \
groupadd -r admin && useradd -g admin admin && \
yum install -y man && \
yum install -y dstat && \
yum install -y unzip && \
yum install -y nc && \
yum install -y openssh-server && \
yum install -y tar && \
yum install -y which && \
yum install -y wget && \
yum install -y perl && \
yum install -y file && \
ssh-keygen -q -N "" -t dsa -f /etc/ssh/ssh_host_dsa_key && \
ssh-keygen -q -N "" -t rsa -f /etc/ssh/ssh_host_rsa_key && \
sed -ri 's/session required pam_loginuid.so/#session required pam_loginuid.so/g' /etc/pam.d/sshd && \
sed -i -e 's/^#Port 22$/Port 2222/' /etc/ssh/sshd_config && \
mkdir -p /root/.ssh && chown root.root /root && chmod 700 /root/.ssh && \
yum install -y cronie && \
sed -i '/session required pam_loginuid.so/d' /etc/pam.d/crond && \
true
COPY ${jdk_rpm} /tmp/
RUN \
touch /var/lib/rpm/* && \
#if [ "$BUILDPLATFORM" == "linux/amd64" ] ; then wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=xxx; oraclelicense=accept-securebackup-cookie" "$DOWNLOAD_AMD_LINK" -O /tmp/jdk-8-linux.rpm ; fi && \
#if [ "$BUILDPLATFORM" == "linux/arm64" ] ; then wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=xxx; oraclelicense=accept-securebackup-cookie" "$DOWNLOAD_ARM_LINK" -O /tmp/jdk-8-linux.rpm ; fi && \
yum -y install /tmp/jdk-*.rpm && \
/bin/rm -f /tmp/jdk-*.rpm && \
echo "export JAVA_HOME=/usr/java/latest" >> /etc/profile && \
echo "export PATH=\$JAVA_HOME/bin:\$PATH" >> /etc/profile && \
wget "$NODE_EPORTER_LINK" -O /tmp/node_exporter.tar.gz && \
yum clean all && \
true
CMD ["/bin/bash"]

View File

@@ -0,0 +1,14 @@
# amd64
FROM canal/osbase:v3-amd64
MAINTAINER agapple (jianghang115@gmail.com)
RUN \
groupadd -r mysql && useradd -r -g mysql mysql && \
wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm && \
rpm -ivh mysql80-community-release-el7-3.noarch.rpm && \
yum install mysql-community-server --nogpgcheck -y && \
yum clean all && \
true
CMD ["/bin/bash"]

View File

@@ -0,0 +1,43 @@
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-7 - Base
mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/7/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-7 - Updates
mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/7/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-7 - Extras
mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/7/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-7 - Plus
mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/7/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

View File

@@ -1,10 +1,15 @@
FROM centos:centos6.10 # arm64
FROM centos:centos7.9.2009@sha256:73f11afcbb50d8bc70eab9f0850b3fa30e61a419bc48cf426e63527d14a8373b
ARG jdk_rpm
ARG platform_env
MAINTAINER agapple (jianghang115@gmail.com) MAINTAINER agapple (jianghang115@gmail.com)
# env DOWNLOAD_AMD_LINK="https://download.oracle.com/otn/java/jdk/8u361-b09/0ae14417abb444ebb02b9815e2103550/jdk-8u361-linux-x64.rpm"
# env DOWNLOAD_ARM_LINK="https://download.oracle.com/otn/java/jdk/8u361-b09/0ae14417abb444ebb02b9815e2103550/jdk-8u361-linux-aarch64.rpm"
env NODE_EPORTER_LINK="https://github.com/prometheus/node_exporter/releases/download/v1.6.1/node_exporter-1.6.1.linux-arm64.tar.gz"
env DOWNLOAD_LINK="https://download.oracle.com/otn-pub/java/jdk/8u281-b09/89d678f2be164786b292527658ca1605/jdk-8u281-linux-x64.rpm"
# install system # install system
# update yum config, fix "centos6.x yum install failure && Determining fastest mirrors slow" problems # update yum config, fix "centos6.x yum install failure && Determining fastest mirrors slow" problems
COPY yum/ /tmp/ COPY yum/ /tmp/
RUN \ RUN \
@@ -39,13 +44,14 @@ RUN \
sed -i '/session required pam_loginuid.so/d' /etc/pam.d/crond && \ sed -i '/session required pam_loginuid.so/d' /etc/pam.d/crond && \
true true
COPY ${jdk_rpm} /tmp/
RUN \ RUN \
touch /var/lib/rpm/* && \ touch /var/lib/rpm/* && \
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=xxx; oraclelicense=accept-securebackup-cookie" "$DOWNLOAD_LINK" -O /tmp/jdk-8-linux-x64.rpm && \ yum -y install /tmp/jdk-*.rpm && \
yum -y install /tmp/jdk-8-linux-x64.rpm && \ /bin/rm -f /tmp/jdk-*.rpm && \
/bin/rm -f /tmp/jdk-8-linux-x64.rpm && \
echo "export JAVA_HOME=/usr/java/latest" >> /etc/profile && \ echo "export JAVA_HOME=/usr/java/latest" >> /etc/profile && \
echo "export PATH=\$JAVA_HOME/bin:\$PATH" >> /etc/profile && \ echo "export PATH=\$JAVA_HOME/bin:\$PATH" >> /etc/profile && \
wget "$NODE_EPORTER_LINK" -O /tmp/node_exporter.tar.gz && \
yum clean all && \ yum clean all && \
true true

View File

@@ -0,0 +1,14 @@
# arm64
FROM canal/osbase:v3-arm64
MAINTAINER agapple (jianghang115@gmail.com)
RUN \
groupadd -r mysql && useradd -r -g mysql mysql && \
wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm && \
rpm -ivh mysql80-community-release-el7-3.noarch.rpm && \
yum install mysql-community-server --nogpgcheck -y && \
yum clean all && \
true
CMD ["/bin/bash"]

View File

@@ -0,0 +1,48 @@
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/altarch/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64
#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/altarch/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/altarch/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64
enabled=1
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/altarch/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64

View File

@@ -1,66 +0,0 @@
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
[base]
name=CentOS-$releasever - Base
failovermethod=priority
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=https://mirrors.aliyun.com/centos-vault/centos/$releasever/os/$basearch/
https://mirrors.cloud.tencent.com/centos/$releasever/os/$basearch/
https://vault.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-$releasever - Updates
failovermethod=priority
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
baseurl=https://mirrors.aliyun.com/centos-vault/centos/$releasever/updates/$basearch/
https://mirrors.cloud.tencent.com/centos/$releasever/updates/$basearch/
https://vault.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
failovermethod=priority
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
baseurl=https://mirrors.aliyun.com/centos-vault/centos/$releasever/extras/$basearch/
https://mirrors.cloud.tencent.com/centos/$releasever/extras/$basearch/
https://vault.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
failovermethod=priority
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
baseurl=https://mirrors.aliyun.com/centos-vault/centos/$releasever/centosplus/$basearch/
https://mirrors.cloud.tencent.com/centos/6.0/centosplus/$basearch/
https://vault.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
failovermethod=priority
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib&infra=$infra
baseurl=https://mirrors.aliyun.com/centos-vault/centos/$releasever/contrib/$basearch/
https://mirrors.cloud.tencent.com/centos/$releasever/contrib/$basearch/
https://vault.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

View File

@@ -14,13 +14,8 @@ case "`uname`" in
esac esac
BASE=${bin_abs_path} BASE=${bin_abs_path}
if [ "$1" == "base" ] ; then
docker build --no-cache -t canal/osbase $BASE/base if [ "$1" == "admin" ] ; then
elif [ "$1" == "base_v2" ] ; then
docker build --no-cache -t canal/osbase $BASE/base -f $BASE/base/Dockerfile_v2
elif [ "$1" == "base_admin" ] ; then
docker build --no-cache -t canal/osadmin $BASE/base -f $BASE/base/Dockerfile_admin
elif [ "$1" == "admin" ] ; then
rm -rf $BASE/canal.*.tar.gz ; rm -rf $BASE/canal.*.tar.gz ;
cd $BASE/../ && mvn clean package -Dmaven.test.skip -Denv=release && cd $current_path ; cd $BASE/../ && mvn clean package -Dmaven.test.skip -Denv=release && cd $current_path ;
cp $BASE/../target/canal.admin-*.tar.gz $BASE/ cp $BASE/../target/canal.admin-*.tar.gz $BASE/

View File

@@ -12,8 +12,8 @@ for e in $(ls /alidata/init/*) ; do
done done
echo "==> INIT DEFAULT" echo "==> INIT DEFAULT"
service sshd start systemctl start sshd
service crond start systemctl start crond
#echo "check hostname -i: `hostname -i`" #echo "check hostname -i: `hostname -i`"
#hti_num=`hostname -i|awk '{print NF}'` #hti_num=`hostname -i|awk '{print NF}'`
@@ -24,4 +24,4 @@ service crond start
echo "==> INIT DONE" echo "==> INIT DONE"
echo "==> RUN ${*}" echo "==> RUN ${*}"
exec "${@}" exec "${@}"

View File

@@ -87,7 +87,7 @@ function start_canal() {
su admin -c 'cd /home/admin/canal-server/bin/ && sh restart.sh local 1>>/tmp/start.log 2>&1' su admin -c 'cd /home/admin/canal-server/bin/ && sh restart.sh local 1>>/tmp/start.log 2>&1'
sleep 5 sleep 5
#check start #check start
checkStart "canal" "nc 127.0.0.1 $adminPort -w 1 -z | wc -l" 30 checkStart "canal" "nc 127.0.0.1 $adminPort -w 1 -zv 2> /tmp/nc.out && cat /tmp/nc.out | grep -c Connected" 30
else else
metricsPort=`perl -le 'print $ENV{"canal.metrics.pull.port"}'` metricsPort=`perl -le 'print $ENV{"canal.metrics.pull.port"}'`
if [ -z "$metricsPort" ] ; then if [ -z "$metricsPort" ] ; then
@@ -120,7 +120,7 @@ function start_canal() {
su admin -c 'cd /home/admin/canal-server/bin/ && sh restart.sh 1>>/tmp/start.log 2>&1' su admin -c 'cd /home/admin/canal-server/bin/ && sh restart.sh 1>>/tmp/start.log 2>&1'
sleep 5 sleep 5
#check start #check start
checkStart "canal" "nc 127.0.0.1 $metricsPort -w 1 -z | wc -l" 30 checkStart "canal" "nc 127.0.0.1 $metricsPort -w 1 -zv 2> /tmp/nc.out && cat /tmp/nc.out | grep -c Connected" 30
fi fi
} }

View File

@@ -97,6 +97,6 @@ fi
MEMORY="-m 4096m" MEMORY="-m 4096m"
LOCALHOST=`getMyIp` LOCALHOST=`getMyIp`
cmd="docker run -d -it -h $LOCALHOST $CONFIG --name=canal-server $VOLUMNS $NET_MODE $PORTS $MEMORY canal/canal-server" cmd="docker run -d --privileged=true -it -h $LOCALHOST $CONFIG --name=canal-server $VOLUMNS $NET_MODE $PORTS $MEMORY canal/canal-server"
echo $cmd echo $cmd
eval $cmd eval $cmd

View File

@@ -86,6 +86,6 @@ fi
MEMORY="-m 1024m" MEMORY="-m 1024m"
LOCALHOST=`getMyIp` LOCALHOST=`getMyIp`
cmd="docker run -d -it -h $LOCALHOST $CONFIG --name=canal-admin $VOLUMNS $NET_MODE $PORTS $MEMORY canal/canal-admin" cmd="docker run -d --privileged=true -it -h $LOCALHOST $CONFIG --name=canal-admin $VOLUMNS $NET_MODE $PORTS $MEMORY canal/canal-admin"
echo $cmd echo $cmd
eval $cmd eval $cmd