From 4db96282d126e10c691474264fcdbeca2398555e Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Wed, 11 Nov 2020 06:30:49 +0100 Subject: Add supervisord to run ssh and jupyter in parallel --- build/buildah-remote.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'build') diff --git a/build/buildah-remote.sh b/build/buildah-remote.sh index 1016d19..5e9d038 100644 --- a/build/buildah-remote.sh +++ b/build/buildah-remote.sh @@ -8,6 +8,9 @@ image="$1" container=$(buildah from ${image}:latest) buildah config --port 2222/tcp --port 8888/tcp $container +buildah run $container sh -c 'apt-get install -y supervisor' + + buildah run $container sh -c "echo '$(id -ng):x:$(id -g):' >> /etc/group" #buildah run $container sh -c "echo '$(id -nu):x:$(id -u):$(id -g):$(id -nu):/ccpi/data:/bin/bash' >> /etc/passwd" buildah run $container sh -c "echo '$(id -nu):x:0:0:$(id -nu):/ccpi/data:/bin/bash' >> /etc/passwd" @@ -15,6 +18,24 @@ buildah run $container sh -c "echo '$(id -nu):x:0:0:$(id -nu):/ccpi/data:/bin/ba buildah run $container sh -c 'service ssh start' buildah run $container sh -c "echo '$(id -nu):test' | chpasswd" +buildah run $container sh -c 'cat </etc/supervisord.conf +[supervisord] +nodaemon=false + +[program:sshd] +command=/usr/sbin/sshd -D -p 2222 +autorestart=true +startsecs=2 +exitcodes=0 + +[program:jupyter] +command=jupyter notebook --allow-root --no-browser --ip 0.0.0.0 --port=8888 --notebook-dir=/ccpi/data/ +autorestart=true +startsecs=5 +exitcodes=0 +EOF +' + buildah commit --format docker $container ${image}-remote:latest echo "$container build from ${image} and saved as ${image}-remote" -- cgit v1.2.1