基于Centos7的UI自动化环境Dockerfile
FROM centos:7
MAINTAINER linvaux <[email protected]>
WORKDIR /opt
# 修改源,安装依赖
RUN sed -i "s/#baseurl/baseurl/g" /etc/yum.repos.d/CentOS-Base.repo && \
sed -i "s/mirrorlist=http/#mirrorlist=http/g" /etc/yum.repos.d/CentOS-Base.repo && \
sed -i "s@http://mirror.centos.org@https://repo.huaweicloud.com@g" /etc/yum.repos.d/CentOS-Base.repo && \
yum clean all && \
yum makecache && \
yum update -y && \
yum install -y wget git zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel libffi-devel gcc make
# 安装JDK1.8
RUN wget http://10.177.248.111:8089/ftp/dev_tools/jdk-8u271-linux-x64.tar.gz && \
tar -vxf jdk-8u271-linux-x64.tar.gz && \
mv jdk1.8.0_271/ /usr/local/ && \
echo 'export JAVA_HOME=/usr/local/jdk1.8.0_271' >> /etc/profile && \
echo 'export JRE_HOME=${JAVA_HOME}/jre' >> /etc/profile && \
echo 'export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib' >> /etc/profile && \
echo 'export PATH=${JAVA_HOME}/bin:$PATH' >> /etc/profile
echo `java -version`
# 安装python3.7
RUN wget https://mirrors.huaweicloud.com/python/3.7.8/Python-3.7.8.tgz && \
tar -vxf Python-3.7.8.tgz && \
mv Python-3.7.8 /usr/local/python378 && \
cd /usr/local/python378 && \
./configure --prefix=/usr/local/python378 --enable-loadable-sqlite-extensions --with-ssl &&\
make -j$(nproc) && \
make install -j$(nproc) && \
ln -s /usr/local/python378/bin/python3.7 /usr/bin/python3 && \
ln -s /usr/local/python378/bin/pip3 /usr/bin/pip3 && \
mkdir /root/.pip && \
echo "[global]" > /root/.pip/pip.conf && \
echo "index-url=https://pypi.douban.com/simple/" >> /root/.pip/pip.conf && \
echo "[install]" >> /root/.pip/pip.conf && \
echo "trusted-host=pypi.douban.com" >> /root/.pip/pip.conf
echo `python3 -V`
# 安装chrome
RUN echo '[google-chrome]' > /etc/yum.repos.d/google-chrome.repo && \
echo 'name=google-chrome' >> /etc/yum.repos.d/google-chrome.repo && \
echo 'baseurl=http://dl.google.com/linux/chrome/rpm/stable/$basearch' >> /etc/yum.repos.d/google-chrome.repo && \
echo 'enabled=1' >> /etc/yum.repos.d/google-chrome.repo && \
echo 'gpgcheck=1' >> /etc/yum.repos.d/google-chrome.repo && \
echo 'gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub' >> /etc/yum.repos.d/google-chrome.repo && \
yum -y install google-chrome-stable --nogpgcheck && \
echo `google-chrome --version`
# 安装chromedriver驱动
# 安装allure
RUN rm -rf jdk-8u271-linux-x64.tar.gz && \
rm -rf Python-3.7.8.tgz && \
yum clean all