2016-05-26 20:14:27 -07:00
|
|
|
FROM ubuntu:trusty
|
|
|
|
|
|
|
|
#RUN echo 'Acquire::http::Proxy "http://172.17.0.3:3128";' > /etc/apt/apt.conf
|
2015-01-06 18:56:01 -08:00
|
|
|
|
2016-05-15 16:21:37 -07:00
|
|
|
# Admin user
|
2016-05-26 20:14:27 -07:00
|
|
|
RUN useradd --create-home --groups sudo admin ; echo "admin:admin" | chpasswd ; locale-gen en_US en_US.UTF-8
|
2015-01-06 18:56:01 -08:00
|
|
|
# ZNC user
|
|
|
|
RUN useradd --create-home znc ; echo "znc:znc" | chpasswd
|
|
|
|
|
2015-01-24 15:54:45 -08:00
|
|
|
# Install sshd, znc, znc extras, nginx, pisg
|
2016-05-26 20:14:27 -07:00
|
|
|
RUN mkdir /var/run/sshd ; apt-get update ; apt-get install -y supervisor vim openssh-server znc znc-python znc-dev dpkg-dev pisg nginx-full irssi screen ; rm /etc/ssh/ssh_host_* ; mkdir /etc/ssh/keys ; sed -i -E 's/HostKey \/etc\/ssh\//HostKey \/etc\/ssh\/keys\//' /etc/ssh/sshd_config
|
2015-01-06 18:56:01 -08:00
|
|
|
|
|
|
|
# Get ZNC source
|
2016-05-26 20:14:27 -07:00
|
|
|
RUN su -c 'cd /home/znc ; apt-get source znc' znc ; mkdir /srv/znc ; chown znc:znc /srv/znc
|
2015-01-06 18:56:01 -08:00
|
|
|
|
2015-01-23 23:37:24 -08:00
|
|
|
# Set nginx workers to a low number
|
2016-05-15 16:21:37 -07:00
|
|
|
RUN sed -i -e"s/^worker_processes\s*4/worker_processes 1/" /etc/nginx/nginx.conf
|
2015-01-23 23:37:24 -08:00
|
|
|
# Set nginx user to ZNC user
|
|
|
|
RUN sed -i -e"s/^user\s*www\-data/user znc/" /etc/nginx/nginx.conf
|
2015-01-23 23:50:17 -08:00
|
|
|
# Turn off nginx daemon mode
|
2015-01-23 23:37:24 -08:00
|
|
|
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
|
2015-01-24 00:05:29 -08:00
|
|
|
# Set up nginx
|
|
|
|
COPY default /etc/nginx/sites-available/default
|
2015-01-24 15:54:45 -08:00
|
|
|
|
|
|
|
# Install pisg stuff for log generation
|
2016-05-26 20:14:27 -07:00
|
|
|
COPY pisg.py /usr/local/bin/pisg.py
|
|
|
|
RUN chmod +x /usr/local/bin/pisg.py
|
2015-01-24 15:54:45 -08:00
|
|
|
|
2015-01-23 23:37:24 -08:00
|
|
|
# Install crontab
|
|
|
|
COPY crontab /tmp/
|
|
|
|
RUN crontab -u znc /tmp/crontab
|
|
|
|
RUN rm /tmp/crontab
|
2015-01-23 23:50:17 -08:00
|
|
|
|
2015-01-24 15:54:45 -08:00
|
|
|
# Install startup stuff
|
2015-05-03 16:25:12 -07:00
|
|
|
COPY supervisor.conf /etc/supervisor/conf.d/supervisor.conf
|
|
|
|
COPY nginx.conf /etc/supervisor/conf.d/nginx.conf
|
2016-05-15 16:21:37 -07:00
|
|
|
COPY cron.conf /etc/supervisor/conf.d/cron.conf
|
2015-05-03 16:25:12 -07:00
|
|
|
COPY znc.conf /etc/supervisor/conf.d/znc.conf
|
|
|
|
COPY sshd.conf /etc/supervisor/conf.d/sshd.conf
|
2015-01-24 15:54:45 -08:00
|
|
|
COPY start /start
|
|
|
|
RUN chmod +x /start
|
2015-01-23 23:37:24 -08:00
|
|
|
|
2016-05-26 20:14:27 -07:00
|
|
|
VOLUME ["/srv/znc", "/etc/ssh/keys"]
|
|
|
|
|
2015-01-24 15:54:45 -08:00
|
|
|
# ssh
|
|
|
|
EXPOSE 22
|
|
|
|
# nginx
|
2015-01-23 23:37:24 -08:00
|
|
|
EXPOSE 80
|
2016-05-15 16:21:37 -07:00
|
|
|
|
2016-05-26 20:14:27 -07:00
|
|
|
ENTRYPOINT ["/start"]
|