Dockerfile 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. # arm64
  2. FROM centos:centos7.9.2009@sha256:73f11afcbb50d8bc70eab9f0850b3fa30e61a419bc48cf426e63527d14a8373b
  3. ARG jdk_rpm
  4. ARG platform_env
  5. MAINTAINER agapple (jianghang115@gmail.com)
  6. # env DOWNLOAD_AMD_LINK="https://download.oracle.com/otn/java/jdk/8u361-b09/0ae14417abb444ebb02b9815e2103550/jdk-8u361-linux-x64.rpm"
  7. # env DOWNLOAD_ARM_LINK="https://download.oracle.com/otn/java/jdk/8u361-b09/0ae14417abb444ebb02b9815e2103550/jdk-8u361-linux-aarch64.rpm"
  8. env NODE_EPORTER_LINK="https://github.com/prometheus/node_exporter/releases/download/v1.6.1/node_exporter-1.6.1.linux-arm64.tar.gz"
  9. # install system
  10. # update yum config, fix "centos6.x yum install failure && Determining fastest mirrors slow" problems
  11. COPY yum/ /tmp/
  12. RUN \
  13. /bin/cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak && \
  14. /bin/cp -f /tmp/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo && \
  15. /bin/cp /etc/yum/pluginconf.d/fastestmirror.conf /etc/yum/pluginconf.d/fastestmirror.conf.bak && \
  16. awk '{ if($0=="enabled=1"){print "enabled=0";} else{print $0;} }' /etc/yum/pluginconf.d/fastestmirror.conf.bak > /etc/yum/pluginconf.d/fastestmirror.conf && \
  17. /bin/cp /etc/yum.conf /etc/yum.conf.bak && \
  18. echo 'minrate=1' >> /etc/yum.conf && echo 'timeout=600' >> /etc/yum.conf && \
  19. yum clean all && yum makecache
  20. RUN \
  21. /usr/bin/ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
  22. echo 'root:Hello1234' | chpasswd && \
  23. groupadd -r admin && useradd -g admin admin && \
  24. yum install -y man && \
  25. yum install -y dstat && \
  26. yum install -y unzip && \
  27. yum install -y nc && \
  28. yum install -y openssh-server && \
  29. yum install -y tar && \
  30. yum install -y which && \
  31. yum install -y wget && \
  32. yum install -y perl && \
  33. yum install -y file && \
  34. ssh-keygen -q -N "" -t dsa -f /etc/ssh/ssh_host_dsa_key && \
  35. ssh-keygen -q -N "" -t rsa -f /etc/ssh/ssh_host_rsa_key && \
  36. sed -ri 's/session required pam_loginuid.so/#session required pam_loginuid.so/g' /etc/pam.d/sshd && \
  37. sed -i -e 's/^#Port 22$/Port 2222/' /etc/ssh/sshd_config && \
  38. mkdir -p /root/.ssh && chown root.root /root && chmod 700 /root/.ssh && \
  39. yum install -y cronie && \
  40. sed -i '/session required pam_loginuid.so/d' /etc/pam.d/crond && \
  41. true
  42. COPY ${jdk_rpm} /tmp/
  43. RUN \
  44. touch /var/lib/rpm/* && \
  45. yum -y install /tmp/jdk-*.rpm && \
  46. /bin/rm -f /tmp/jdk-*.rpm && \
  47. echo "export JAVA_HOME=/usr/java/latest" >> /etc/profile && \
  48. echo "export PATH=\$JAVA_HOME/bin:\$PATH" >> /etc/profile && \
  49. wget "$NODE_EPORTER_LINK" -O /tmp/node_exporter.tar.gz && \
  50. yum clean all && \
  51. true
  52. CMD ["/bin/bash"]