Dockerfile 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # amd64
  2. FROM centos:centos7.9.2009@sha256:dead07b4d8ed7e29e98de0f4504d87e8880d4347859d839686a31da35a3b532f
  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-amd64.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. #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 && \
  46. #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 && \
  47. yum -y install /tmp/jdk-*.rpm && \
  48. /bin/rm -f /tmp/jdk-*.rpm && \
  49. echo "export JAVA_HOME=/usr/java/latest" >> /etc/profile && \
  50. echo "export PATH=\$JAVA_HOME/bin:\$PATH" >> /etc/profile && \
  51. wget "$NODE_EPORTER_LINK" -O /tmp/node_exporter.tar.gz && \
  52. yum clean all && \
  53. true
  54. CMD ["/bin/bash"]