Skip to content

Commit

Permalink
[Al2023] Adding Docker file for AL2023
Browse files Browse the repository at this point in the history
  • Loading branch information
Himani Deshpande authored and hanwen-pcluste committed Jun 12, 2024
1 parent 60538cf commit 92ae950
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions cli/src/pcluster/resources/batch/docker/alinux2023/Dockerfile
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"]

0 comments on commit 92ae950

Please sign in to comment.