blob: 7cb0eeb78965ed9f13e3780e43d751590ade49cb (
plain)
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
|
#! /usr/bin/env bash
set -o errexit
image="$1"
[ -n "$image" ] || { echo "Usage: $0 <astra|ccpi|ufo|tomo|imageX> [tag]"; exit 1; }
tag=latest
[ -n "$2" ] && tag="$2"
container=$(buildah from ${image}:${tag})
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"
buildah run $container sh -c 'service ssh start'
buildah run $container sh -c "echo '$(id -nu):test' | chpasswd"
buildah run $container sh -c 'cat <<EOF >/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:${tag}
echo "$container build from ${image}:${tag} and saved as ${image}-remote:${tag}"
|