docker/ops/Dockerfile
2022-07-03 15:55:01 +08:00

36 lines
1.9 KiB
Docker

ARG ARCH
FROM harbor.colben.cn/general/jdk$ARCH:8
MAINTAINER Colben colbenlee@gmail.com
RUN tdnf makecache \
&& tdnf -y install git openssh openssh-clients openssh-server sshpass jq ansible \
&& mkdir -m 0700 /root/.ssh \
&& sed -i \
-e '/^Port /d' \
-e '/^PermitRootLogin /d' \
-e '/^TCPKeepAlive /d' \
-e '/^ClientAliveInterval /d' \
-e '/^ClientAliveCountMax /d' \
-e '/^UseDNS /d' \
-e '$aPort 20022' \
-e '$aPermitRootLogin yes' \
-e '$aTCPKeepAlive yes' \
-e '$aClientAliveInterval 60' \
-e '$aClientAliveCountMax 3' \
-e '$aUseDNS yes' \
/etc/ssh/sshd_config \
&& grep '^export PS' /etc/bash.bashrc | sed 's/\\h/OPS/' >> /etc/profile \
&& echo 'export LANG=en_US.UTF-8' >> /etc/profile \
&& echo 'export JAVA_HOME=/opt/jdk' >> /etc/profile \
&& echo 'export JRE_HOME=$JAVA_HOME/jre' >> /etc/profile \
&& echo 'export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib' >> /etc/profile \
&& echo 'export MAVEN_HOME=/opt/maven' >> /etc/profile \
&& echo 'export PATH=$MAVEN_HOME/bin:$JAVA_HOME/bin:$PATH' >> /etc/profile \
&& rm -rf /var/cache/tdnf
ADD --chown=root:root /ADD/maven /opt/maven
ADD --chown=root:root /ADD/ssh_host_* /etc/ssh/
ADD --chown=root:root /ADD/id_rsa* /root/.ssh/
ENV MAVEN_HOME=/opt/maven
ENV PATH=$MAVEN_HOME/bin:$PATH
CMD ["/usr/sbin/sshd", "-D"]