diff --git a/CentOS-8-reg.repo b/CentOS-8-reg.repo new file mode 100644 index 0000000..8017061 --- /dev/null +++ b/CentOS-8-reg.repo @@ -0,0 +1,52 @@ +# 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. +# +# + +[BaseOS] +name=CentOS-$releasever - Base - repo.huaweicloud.com +baseurl=https://repo.huaweicloud.com/centos-vault/8.5.2111/BaseOS/$basearch/os/ +#mirrorlist=https://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS&infra=$infra +gpgcheck=1 +gpgkey=https://repo.huaweicloud.com/centos/RPM-GPG-KEY-CentOS-Official + +#released updates +[AppStream] +name=CentOS-$releasever - AppStream - repo.huaweicloud.com +baseurl=https://repo.huaweicloud.com/centos-vault/8.5.2111/AppStream/$basearch/os/ +#mirrorlist=https://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra +gpgcheck=1 +gpgkey=https://repo.huaweicloud.com/centos/RPM-GPG-KEY-CentOS-Official + +[PowerTools] +name=CentOS-$releasever - PowerTools - repo.huaweicloud.com +baseurl=https://repo.huaweicloud.com/centos-vault/8.5.2111/PowerTools/$basearch/os/ +#mirrorlist=https://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=PowerTools&infra=$infra +gpgcheck=1 +gpgkey=https://repo.huaweicloud.com/centos/RPM-GPG-KEY-CentOS-Official + + +#additional packages that may be useful +[extras] +name=CentOS-$releasever - Extras - repo.huaweicloud.com +baseurl=https://repo.huaweicloud.com/centos-vault/8.5.2111/extras/$basearch/os/ +#mirrorlist=https://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras +gpgcheck=1 +gpgkey=https://repo.huaweicloud.com/centos/RPM-GPG-KEY-CentOS-Official + + +#additional packages that extend functionality of existing packages +[centosplus] +name=CentOS-$releasever - Plus - repo.huaweicloud.com +baseurl=https://repo.huaweicloud.com/centos-vault/8.5.2111/centosplus/$basearch/os/ +#mirrorlist=https://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus +gpgcheck=1 +enabled=0 +gpgkey=https://repo.huaweicloud.com/centos/RPM-GPG-KEY-CentOS-Official diff --git a/Dockerfile b/Dockerfile index d65932e..a56c5bb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # 构建阶段 FROM centos:8 as build WORKDIR /user/src/app -COPY buildProject.sh . +COPY buildProject.sh CentOS-8-reg.repo ./ RUN sh buildProject.sh COPY . . # 1.执行构建vue,2.执行构建maven diff --git a/buildProject.sh b/buildProject.sh index 1831f46..bc40143 100644 --- a/buildProject.sh +++ b/buildProject.sh @@ -1,13 +1,12 @@ #!/usr/bin/env bash workdir=/opt/screw # 更新国内源 -ls /etc/yum.repos.d -yum -y install wget \ - && wget -O /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-8-reg.repo \ +mv CentOS-8-reg.repo /etc/yum.repos.d/CentOS-Base.repo \ && rm -rf /etc/yum.repos.d/CentOS-Linux-AppStream.repo \ && rm -rf /etc/yum.repos.d/CentOS-Linux-BaseOS.repo \ && yum clean all \ - && yum makecache + && yum makecache \ + && yum -y install wget mkdir -p $workdir && cd $workdir # 下载jdk17 yum install -y java-17-openjdk