-
Notifications
You must be signed in to change notification settings - Fork 313
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Al2023] Adding Docker file for AL2023
- Loading branch information
1 parent
60538cf
commit 92ae950
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
cli/src/pcluster/resources/batch/docker/alinux2023/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
FROM public.ecr.aws/amazonlinux/amazonlinux:2023 | ||
|
||
ENV USER root | ||
|
||
ARG AWS_REGION | ||
|
||
# Copy entrypoint and scripts | ||
COPY scripts/ /parallelcluster/bin/ | ||
RUN chmod +x /parallelcluster/bin/* | ||
|
||
# Modify Amazon Linux yum repo configuration | ||
RUN /parallelcluster/bin/modify_yum_vars.sh "${AWS_REGION}" | ||
|
||
RUN yum update -y \ | ||
&& yum -y install \ | ||
aws-cli \ | ||
binutils \ | ||
gcc \ | ||
iproute \ | ||
nfs-utils \ | ||
openssh-server \ | ||
openssh-clients \ | ||
openmpi \ | ||
openmpi-devel \ | ||
python3 \ | ||
python3-pip \ | ||
which \ | ||
hostname \ | ||
&& yum clean all \ | ||
&& rm -rf /var/cache/yum \ | ||
&& mkdir /var/run/sshd \ | ||
&& mkdir -p /parallelcluster/bin \ | ||
&& export DEBIAN_FRONTEND=noninteractive | ||
|
||
# Setup passwordless ssh | ||
ENV NOTVISIBLE "in users profile" | ||
RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config \ | ||
&& sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd \ | ||
&& echo "export VISIBLE=now" >> /etc/profile | ||
|
||
# create ssh keys | ||
ENV SSHDIR /root/.ssh | ||
RUN echo "${USER} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \ | ||
&& mkdir -p ${SSHDIR} \ | ||
&& touch ${SSHDIR}/sshd_config \ | ||
&& ssh-keygen -t rsa -f ${SSHDIR}/ssh_host_rsa_key -N '' \ | ||
&& cp ${SSHDIR}/ssh_host_rsa_key.pub ${SSHDIR}/authorized_keys \ | ||
&& cp ${SSHDIR}/ssh_host_rsa_key ${SSHDIR}/id_rsa \ | ||
&& echo " IdentityFile ${SSHDIR}/id_rsa" >> /etc/ssh/ssh_config \ | ||
&& echo "Host *" >> /etc/ssh/ssh_config && echo " StrictHostKeyChecking no" >> /etc/ssh/ssh_config \ | ||
&& chmod -R 600 ${SSHDIR}/* \ | ||
&& chown -R ${USER}:${USER} ${SSHDIR}/ | ||
|
||
# setup path | ||
ENV PATH "/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/lib64/openmpi/bin/" | ||
|
||
# expose ssh port | ||
EXPOSE 22 | ||
|
||
ENTRYPOINT ["/parallelcluster/bin/entrypoint.sh"] |