Dockerfile 3.2 KB

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