-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path002_base_image.buildconfig.yaml
67 lines (61 loc) · 2.23 KB
/
002_base_image.buildconfig.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
name: mpi-base-image
spec:
output:
to:
kind: ImageStreamTag
name: mpi:base
source:
dockerfile: |2
FROM registry.access.redhat.com/ubi8/ubi
ENV USER_NAME=mpi \
USER=mpi \
HOME=/home/mpi
WORKDIR ${HOME}
RUN dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm \
&& dnf -y install --quiet \
vim openssh-server openssh-clients openmpi \
\
&& ln -s /usr/lib64/openmpi/bin/orted /usr/bin/orted \
\
&& (echo "Host *"; echo " StrictHostKeyChecking no") >> /etc/ssh/ssh_config.d/StrictHostKeyChecking.conf \
&& (echo "Host *"; echo " IdentityFile /home/mpi/.ssh/id_rsa") >> /etc/ssh/ssh_config.d/IdentityFile.conf \
&& (echo "Host *"; echo " Port 2222") >> /etc/ssh/ssh_config.d/Port_2222.conf \
&& (echo "Host *"; echo " UserKnownHostsFile /dev/null") >> /etc/ssh/ssh_config.d/UserKnownHostsFile.conf \
\
&& mkdir -p ${HOME}/custom_ssh \
&& ssh-keygen -f ${HOME}/custom_ssh/ssh_host_rsa_key -N '' -t rsa \
&& ssh-keygen -f ${HOME}/custom_ssh/ssh_host_dsa_key -N '' -t dsa \
\
&& echo -e > ${HOME}/custom_ssh/sshd_config "\
Port 2222 \n\
HostKey ${HOME}/custom_ssh/ssh_host_rsa_key \n\
HostKey ${HOME}/custom_ssh/ssh_host_dsa_key \n\
AuthorizedKeysFile .ssh/authorized_keys \n\
ChallengeResponseAuthentication no \n\
UsePAM no \n\
Subsystem sftp /usr/lib/ssh/sftp-server \n\
PidFile ${HOME}/custom_ssh/sshd.pid \n\
StrictModes no \n\
" \
&& rm -f /etc/ssh/sshd_config && ln -s ${HOME}/custom_ssh/sshd_config /etc/ssh/ \
&& rm /sbin/nologin && ln -s /usr/bin/bash /sbin/nologin \
\
&& touch /var/log/lastlog \
&& chgrp utmp /var/log/lastlog \
&& chmod 664 /var/log/lastlog
RUN chgrp -R 0 "${HOME}" \
&& chmod -R g=u "${HOME}"
ENV PATH="${PATH}:/usr/lib64/openmpi/bin/"
type: Dockerfile
strategy:
dockerStrategy:
from:
kind: DockerImage
name: registry.access.redhat.com/ubi8/ubi
type: Docker
triggers:
- type: ConfigChange