步骤
下载git
yum install git -y
安装源会出现问题,需要对源文件进行配置,最简单的是进行替换
由于无法安装wget,需要重写安装源文件。下载源文件
baseurl=https://mirrors.aliyun.com/centos/$releasever/BaseOS/$basearch/os/
对参数进行更改
baseurl=https://mirrors.aliyun.com/centos/8-stream/BaseOS/x86_64/os/
, 替换https协议为http协议
baseurl=https://mirrors.aliyun.com/centos/8-stream/BaseOS/x86_64/os/
安装软件
yum install kernel-devel kernel-headers -y yum install git -y yum install gcc -y
结果
FROM centosMAINTAINER demonfoxENV WORKPATH /usr/localWORKDIR $WORKPATHCOPY CentOS-Linux-Base.repo ./#设置镜像,安装常用软件RUN rm -rf /etc/yum.repos.d/*\&& cp -f ./CentOS-Linux-Base.repo /etc/yum.repos.d/CentOS-Linux-Base.repo\&& yum clean all && yum makecache\&& yum install git -y\&& yum install gcc-c++ -y\&& yum install cmake -y\&& yum install sed -y# 安装boostRUN mkdir home && cd home\&& git clone https://gitee.com/add358/boost.git\&& cd boost\&& ./bootstrap.sh\&& ./b2 install --with-locale --with-thread -prefix=/usr# 安装yum-cppRUN cd /home\&& git clone https://gitee.com/yuanji1020/yaml-cpp.git\&& cd yaml-cpp\&& mkdir build && cd build\&& cmake .. && make && make install# 下载相关文件RUN cd /home\&& git clone https://gitee.com/DemonFox/HJ212Receiver.git\&& cd HJ212Receiver/sources/GB212Service/\&& rm -rf build && mkdir build && cd build\&& sed -i "36c find_package(Boost REQUIRED COMPONENTS thread locale)" ../CMakeLists.txt\&& sed -i "45c Boost::thread" ../CMakeLists.txt\&& sed -i "46c Boost::locale" ../CMakeLists.txt\&& cmake ..\&& make && make installCMD /bin/bash
参考
删除名为none的镜像 “docker image prune”
https://gitee.com/DemonFox/HJ212Receiver
Yum源配置:https://baijiahao.baidu.com/s?id=1708418392526536542&wfr=spider&for=pc
