2017-05-18 18:54:48 -05:00
|
|
|
FROM ubuntu:16.04
|
|
|
|
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
|
|
|
RUN apt-get update
|
|
|
|
RUN apt-get install -y \
|
|
|
|
openssh-server \
|
|
|
|
gcc \
|
|
|
|
vim \
|
|
|
|
make \
|
|
|
|
git \
|
|
|
|
sudo \
|
|
|
|
python \
|
|
|
|
python-dev \
|
|
|
|
python-cffi \
|
|
|
|
libffi-dev \
|
|
|
|
libssl-dev \
|
|
|
|
sshpass \
|
|
|
|
libxml2 \
|
|
|
|
libxslt1-dev \
|
|
|
|
python-setuptools
|
|
|
|
|
2017-07-19 10:10:45 -05:00
|
|
|
# For JNLP launcher
|
2017-05-18 18:54:48 -05:00
|
|
|
RUN apt-get install -y default-jre
|
|
|
|
|
|
|
|
# For syslog test
|
|
|
|
RUN apt-get install -y rsyslog psmisc
|
|
|
|
|
2017-06-26 23:28:51 -05:00
|
|
|
# Remove cffi 1.5.2, will install 1.10.0 by pip later
|
|
|
|
RUN apt-get remove -y python-cffi python-cffi-backend
|
|
|
|
|
2017-05-18 18:54:48 -05:00
|
|
|
RUN easy_install pip
|
|
|
|
|
|
|
|
RUN pip install ipaddr \
|
|
|
|
lxml \
|
|
|
|
netaddr \
|
|
|
|
natsort \
|
|
|
|
six \
|
|
|
|
pexpect \
|
|
|
|
pyasn1==0.1.9 \
|
2017-05-20 12:37:59 -05:00
|
|
|
pysnmp==4.2.5 \
|
2017-06-13 21:16:43 -05:00
|
|
|
jinja2==2.7.2 \
|
2017-06-26 23:28:51 -05:00
|
|
|
cffi==1.10.0 \
|
2017-07-04 02:43:34 -05:00
|
|
|
paramiko==2.1.2 \
|
|
|
|
adal
|
2017-05-18 18:54:48 -05:00
|
|
|
|
2017-07-19 10:10:45 -05:00
|
|
|
|
|
|
|
## Copy and install sonic-mgmt docker dependencies
|
|
|
|
COPY \
|
|
|
|
{% for deb in docker_sonic_mgmt_debs.split(' ') -%}
|
|
|
|
debs/{{ deb }}{{' '}}
|
|
|
|
{%- endfor -%}
|
|
|
|
debs/
|
|
|
|
|
|
|
|
RUN dpkg -i \
|
|
|
|
{% for deb in docker_sonic_mgmt_debs.split(' ') -%}
|
|
|
|
debs/{{ deb }}{{' '}}
|
|
|
|
{%- endfor %}
|
|
|
|
|
2017-05-18 18:54:48 -05:00
|
|
|
RUN git clone https://github.com/ansible/ansible
|
|
|
|
RUN cd ansible && git checkout v2.0.0.2-1 -b v2.0.0.2-1 && git submodule update --init --recursive && make && make install
|
|
|
|
|
|
|
|
RUN mkdir /var/run/sshd
|
|
|
|
EXPOSE 22
|
|
|
|
|
|
|
|
# Add user
|
|
|
|
ARG user
|
|
|
|
ARG uid
|
|
|
|
ARG guid
|
|
|
|
ARG hostname
|
|
|
|
|
|
|
|
ENV BUILD_HOSTNAME $hostname
|
|
|
|
ENV USER $user
|
|
|
|
|
|
|
|
RUN groupadd -f -r -g $guid g$user
|
|
|
|
|
|
|
|
RUN useradd $user -l -u $uid -g $guid -d /var/$user -m -s /bin/bash
|
|
|
|
|
|
|
|
COPY sonic-jenkins.pub /var/$user/.ssh/authorized_keys2
|
|
|
|
|
|
|
|
RUN echo "Host *\n\tStrictHostKeyChecking no\n" > /var/$user/.ssh/config
|
|
|
|
RUN chown $user /var/$user/.ssh -R
|
|
|
|
RUN chmod go= /var/$user/.ssh -R
|
|
|
|
|
|
|
|
# Add user to sudoers
|
|
|
|
RUN echo "$user ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers
|
|
|
|
|
|
|
|
USER $user
|
|
|
|
|
|
|
|
RUN cd /var/$user && git clone https://github.com/Azure/sonic-mgmt
|