FROM ubuntu:latest
COPY sources.list /etc/apt
COPY run.sh /root/
COPY jdk1.8.0_191.zip sshd_config settings.xml usr/local/
ARG JAVA_HOME_ARG=/usr/local/jdk
ENV JAVA_HOME=/usr/local/jdk
ENV PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
WORKDIR /device-management
RUN apt update \
&& apt -y install unzip \
&& apt -y install ssh \
&& apt -y install git \
&& apt -y install maven \
&& apt -y install vim \
&& apt -y install inetutils-ping \
&& apt -y install net-tools \
&& echo "service ssh start" >> /root/.bashrc \
&& unzip -d /usr/local /usr/local/jdk1.8.0_191.zip \
&& ln -s /usr/local/jdk1.8.0_191 /usr/local/jdk \
&& rm -f /usr/local/jdk1.8.0_191.zip \
&& mv /usr/local/sshd_config /etc/ssh/ \
&& mv /usr/local/settings.xml /etc/maven/ \
&& passwd -d root \
&& chmod +x /root/run.sh \
&& git config --global credential.helper store \
&& echo https://thtfpc:thtfpc123@gitee.com > /root/.git-credentials \
&& echo export JAVA_HOME=$JAVA_HOME_ARG >> /etc/profile \
&& echo export PATH=$PATH:$JAVA_HOME_ARG/bin:$JAVA_HOME_ARG/jre/bin >> /etc/profile \
&& git clone https://gitee.com/thtfpc/device-management.git /device-management && cd /device-management \
&& mvn package
CMD /root/run.sh