Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
vnijs committed Dec 12, 2024
1 parent 528bc96 commit ba51ad7
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 1 deletion.
5 changes: 5 additions & 0 deletions files/start-services-simplified.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
set -e

# Start sshd
/usr/sbin/sshd -D &
4 changes: 3 additions & 1 deletion files/supervisord.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[supervisord]
user=%(ENV_NB_USER)s
nodaemon=true
logfile=/var/log/supervisor/supervisord.log
pidfile=/tmp/supervisord.pid
Expand All @@ -12,13 +13,14 @@ stderr_logfile=/var/log/supervisor/%(program_name)s.log
autorestart=false

[program:postgres]
user=%(ENV_NB_USER)s
command=/usr/lib/postgresql/%(ENV_POSTGRES_VERSION)s/bin/postgres -c config_file=/etc/postgresql/%(ENV_POSTGRES_VERSION)s/main/postgresql.conf
user=postgres
stdout_logfile=/var/log/supervisor/%(program_name)s.log
stderr_logfile=/var/log/supervisor/%(program_name)s.log
autorestart=true

[program:sshd]
user=%(ENV_NB_USER)s
command=/usr/sbin/sshd -D
stdout_logfile=/var/log/supervisor/%(program_name)s.log
stderr_logfile=/var/log/supervisor/%(program_name)s.log
Expand Down
11 changes: 11 additions & 0 deletions rsm-msba-arm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,17 @@ RUN mkdir -p /var/run/sshd \
&& chmod 0755 /var/run/sshd \
&& chsh -s $(which zsh) ${NB_USER}

# fixing version issue
RUN apt-get update && \
apt-get install -y openssl=3.0.2* && \
apt-mark hold openssl && \
apt-get install -y openssh-server && \
rm -rf /var/lib/apt/lists/*

# updating permissions
RUN chown -R ${NB_USER} /var/log/ \
&& chmod -R +x /var/log/

# cleanup
RUN rm -rf ~/work/ \
&& rm -f ~/*.*
Expand Down
35 changes: 35 additions & 0 deletions rsm-simple-intel/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# x86_64-ubuntu-22.04 7/25/2024
FROM quay.io/jupyter/pyspark-notebook@sha256:fb5e83562d196ead71f31e4ae1e37c6fe13e1c13c3cbf55d64ffc6166f0aedb7

LABEL Vincent Nijs "[email protected]"

# Fix DL4006
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

USER root

# fixes the issue where sudo requires terminal for password when starting postgres
RUN echo "${NB_USER} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers

COPY files/start-services-simplified.sh /usr/local/bin/start-services.sh
RUN chmod +x /usr/local/bin/start-services.sh

# setting up ssh connection
RUN mkdir -p /var/run/sshd \
&& ssh-keygen -A \
&& echo 'PasswordAuthentication no' >> /etc/ssh/sshd_config \
&& echo 'PermitRootLogin no' >> /etc/ssh/sshd_config \
&& echo 'PubkeyAuthentication yes' >> /etc/ssh/sshd_config \
&& echo "AllowUsers ${NB_USER}" >> /etc/ssh/sshd_config \
&& chmod 0755 /var/run/sshd \
&& chsh -s $(which zsh) ${NB_USER}

EXPOSE 22 8989

# not running any commands yet
CMD ["/usr/local/bin/start-services.sh"]

# Switch back to jovyan to avoid accidental container runs as root
USER ${NB_UID}
ENV HOME /home/${NB_USER}
WORKDIR "${HOME}"

0 comments on commit ba51ad7

Please sign in to comment.