make adding startup tasks more easily extensible
This commit is contained in:
parent
1905526711
commit
a430531e06
@ -24,7 +24,8 @@ COPY sshd.conf /etc/supervisor/conf.d/sshd.conf
|
||||
COPY cron.conf /etc/supervisor/conf.d/cron.conf
|
||||
|
||||
COPY start /start
|
||||
RUN chmod +x /start
|
||||
RUN chmod +x /start ; mkdir /start.d
|
||||
COPY regenerate-ssh /start.d/regenerate-ssh
|
||||
|
||||
# Expose ssh
|
||||
EXPOSE 22
|
||||
|
10
regenerate-ssh
Normal file
10
regenerate-ssh
Normal file
@ -0,0 +1,10 @@
|
||||
#! /bin/bash
|
||||
|
||||
# If sshd has no config, generate new keys + config
|
||||
if [ ! -f /etc/ssh/sshd_config ]; then
|
||||
# Regenerate ssh key per container
|
||||
dpkg-reconfigure openssh-server
|
||||
fi
|
||||
|
||||
# This only runs once, so remove this startup script
|
||||
rm /start.d/regenerate-ssh
|
6
start
Normal file → Executable file
6
start
Normal file → Executable file
@ -1,9 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ! -f /etc/ssh/sshd_config ]; then
|
||||
# Regenerate ssh key per container
|
||||
dpkg-reconfigure openssh-server
|
||||
fi
|
||||
# run everything in start.d
|
||||
find /start.d -type f -executable -exec {} \;
|
||||
|
||||
# Cleanly kill supervisor when container is stopped
|
||||
trap 'kill $(jobs -p)' EXIT
|
||||
|
Loading…
Reference in New Issue
Block a user