mirror of
https://github.com/phusion/baseimage-docker.git
synced 2026-03-26 04:18:46 +00:00
Made services installation optional during build
You can user `ENV` directive in Dockerfile to disable the installation for some services or change `image/buildconfig`. The flags are : DISABLE_SSHD DISABLE_CRON DISABLE_SYSLOG
This commit is contained in:
@@ -19,54 +19,11 @@ ln -s /etc/container_environment.sh /etc/profile.d/
|
||||
## Install runit.
|
||||
$minimal_apt_get_install runit
|
||||
|
||||
## Install a syslog daemon.
|
||||
$minimal_apt_get_install syslog-ng-core
|
||||
mkdir /etc/service/syslog-ng
|
||||
cp /bd_build/runit/syslog-ng /etc/service/syslog-ng/run
|
||||
mkdir -p /var/lib/syslog-ng
|
||||
cp /bd_build/config/syslog_ng_default /etc/default/syslog-ng
|
||||
touch /var/log/syslog
|
||||
chmod u=rw,g=r,o= /var/log/syslog
|
||||
cp /bd_build/config/syslog-ng.conf /etc/syslog-ng/syslog-ng.conf
|
||||
|
||||
## Install syslog to "docker logs" forwarder.
|
||||
mkdir /etc/service/syslog-forwarder
|
||||
cp /bd_build/runit/syslog-forwarder /etc/service/syslog-forwarder/run
|
||||
|
||||
## Install logrotate.
|
||||
$minimal_apt_get_install logrotate
|
||||
cp /bd_build/config/logrotate_syslogng /etc/logrotate.d/syslog-ng
|
||||
## Install a syslog daemon and logrotate.
|
||||
[ "$DISABLE_SYSLOG" -eq 0 ] && /bd_build/services/syslog-ng/syslog-ng.sh
|
||||
|
||||
## Install the SSH server.
|
||||
$minimal_apt_get_install openssh-server
|
||||
mkdir /var/run/sshd
|
||||
mkdir /etc/service/sshd
|
||||
touch /etc/service/sshd/down
|
||||
cp /bd_build/runit/sshd /etc/service/sshd/run
|
||||
cp /bd_build/config/sshd_config /etc/ssh/sshd_config
|
||||
cp /bd_build/00_regen_ssh_host_keys.sh /etc/my_init.d/
|
||||
|
||||
## Install default SSH key for root and app.
|
||||
mkdir -p /root/.ssh
|
||||
chmod 700 /root/.ssh
|
||||
chown root:root /root/.ssh
|
||||
cp /bd_build/insecure_key.pub /etc/insecure_key.pub
|
||||
cp /bd_build/insecure_key /etc/insecure_key
|
||||
chmod 644 /etc/insecure_key*
|
||||
chown root:root /etc/insecure_key*
|
||||
cp /bd_build/bin/enable_insecure_key /usr/sbin/
|
||||
[ "$DISABLE_SSH" -eq 0 ] && /bd_build/services/sshd/sshd.sh
|
||||
|
||||
## Install cron daemon.
|
||||
$minimal_apt_get_install cron
|
||||
mkdir /etc/service/cron
|
||||
chmod 600 /etc/crontab
|
||||
cp /bd_build/runit/cron /etc/service/cron/run
|
||||
|
||||
## Remove useless cron entries.
|
||||
# Checks for lost+found and scans for mtab.
|
||||
rm -f /etc/cron.daily/standard
|
||||
rm -f /etc/cron.daily/upstart
|
||||
rm -f /etc/cron.daily/dpkg
|
||||
rm -f /etc/cron.daily/password
|
||||
rm -f /etc/cron.weekly/fstrim
|
||||
|
||||
[ "$DISABLE_CRON" -eq 0 ] && /bd_build/services/cron/cron.sh
|
||||
|
||||
Reference in New Issue
Block a user