第八期 docker 实战 20190602

作业

  • 用docker 搭建jenkins,testlink,以及模拟测试环境(conan,holmes),selenium grid
  • 在jenkins上搭建起分布式UI自动化的job并运行
  • 自主制作一个简易的镜像

Dockfile demo

UI自动化 slave 镜像

ADD entrypoint.sh /root
ADD jdk /opt/java-1.8

ENV M2_HOME=/usr/local/maven
ENV M2=$M2_HOME/bin
ENV JAVA_HOME=/opt/java-1.8
ENV PATH=$JAVA_HOME:$M2:$PATH

RUN yum install -y wget openssh-server vim git openssh-clients \\
    && /usr/bin/ssh-keygen -A \\
    && wget http://mirror.olnevhost.net/pub/apache/maven/maven-3/3.0.5/binaries/apache-maven-3.0.5-bin.tar.gz \\
    && tar xvf apache-maven-3.0.5-bin.tar.gz \\
    && mv apache-maven-3.0.5  /usr/local/maven \\
    && ssh-keygen -t rsa -f /root/.ssh/id_rsa -N '' \\
    && cat /root/.ssh/id_rsa.pub > /root/.ssh/authorized_keys \\
    && chmod 600 /root/.ssh/authorized_keys \\
    && echo "StrictHostKeyChecking no" > /root/.ssh/config \\
    && echo "UserKnownHostsFile /dev/null" >> /root/.ssh/config \\
    && echo 1qaz9ol.|passwd --stdin root \\
    && echo "export M2_HOME=/usr/local/maven" >> /root/.bashrc \\
    && echo "export M2=$M2_HOME/bin" >> /root/.bashrc \\
    && echo "export JAVA_HOME=/opt/java-1.8" >> /root/.bashrc \\
    && echo "export PATH=$JAVA_HOME:$M2:$PATH" >> /root/.bashrc



ENTRYPOINT ["/bin/bash", "/root/entrypoint.sh"]

为grid的node镜像安装中文雅黑字体和修改密码

FROM selenium/node-chrome-debug:3.7.1-beryllium

USER root

RUN apt-get update \\
    && apt-get -y install ttf-wqy-microhei ttf-wqy-zenhei \\
    && apt-get clean \\
    && mkdir -p mkdir -p ~/.vnc \\
    && x11vnc -storepasswd work123 ~/.vnc/passwd

python基础镜像

FROM centos:7

ADD entrypoint.sh /root
ADD requirements.txt /root
WORKDIR /root
USER root

RUN yum install -y epel-release \\
    && yum install -y python34 git python34-setuptools python34-devel.x86_64 \\
    && easy_install-3.4 pip \\
    && yum install -y gcc \\
    && yum install -y soci-mysql-devel.x86_64 \\
    && ln -s /usr/local/mysql/bin/mysql /usr/bin \\
    && pip3 install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/


ENTRYPOINT ["/root/entrypoint.sh"]