Added supervisor/logrotate and startup dirs use symlinks

This commit is contained in:
Deon George 2019-08-14 20:56:48 +10:00
parent 3d0236736d
commit 5dcdfd0705
4 changed files with 33 additions and 9 deletions

View File

@ -5,11 +5,14 @@ FROM debian:stretch-slim
# Base utilities # Base utilities
RUN apt-get update \ RUN apt-get update \
&& apt-get install -yqq curl procps less zip unzip arj unrar-free lhasa arc zoo logrotate libmozjs185-1.0 cron \ && apt-get install -yqq curl supervisor procps less zip unzip arj unrar-free lhasa arc zoo logrotate libmozjs185-1.0 cron \
&& apt-get -y autoremove \ && apt-get -y autoremove \
&& apt-get clean \ && apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Set the default timezone for the container
RUN ln -sf /usr/share/zoneinfo/Australia/Melbourne /etc/localtime
# Add in Leenooks' apt repository # Add in Leenooks' apt repository
RUN curl -s http://apt.leenooks.net/setup.sh | sh RUN curl -s http://apt.leenooks.net/setup.sh | sh
@ -31,6 +34,7 @@ RUN apt-get update \
&& make RELEASE=1 USE_DOSEMU=1 NO_X=1 JSINCLUDE=/usr/include/js JSLIB=mozjs185 SBBSDIR=/opt/sbbs install \ && make RELEASE=1 USE_DOSEMU=1 NO_X=1 JSINCLUDE=/usr/include/js JSLIB=mozjs185 SBBSDIR=/opt/sbbs install \
&& rm -rf /opt/sbbs/3rdp /opt/sbbs/src \ && rm -rf /opt/sbbs/3rdp /opt/sbbs/src \
&& mv /opt/sbbs/ctrl /opt/sbbs/ctrl.orig \ && mv /opt/sbbs/ctrl /opt/sbbs/ctrl.orig \
&& mv /opt/sbbs/text /opt/sbbs/text.orig \
&& mkdir /opt/sbbs/nodes.orig && mv /opt/sbbs/node[1-4] /opt/sbbs/nodes.orig \ && mkdir /opt/sbbs/nodes.orig && mv /opt/sbbs/node[1-4] /opt/sbbs/nodes.orig \
&& ln -sf nodes/node1 /opt/sbbs/ \ && ln -sf nodes/node1 /opt/sbbs/ \
&& ln -sf nodes/node2 /opt/sbbs/ \ && ln -sf nodes/node2 /opt/sbbs/ \
@ -47,12 +51,12 @@ ENV SBBSCTRL=/opt/sbbs/ctrl
ENV SBBSEXEC=/opt/sbbs/exec ENV SBBSEXEC=/opt/sbbs/exec
ENV PATH=$PATH:${SBBSEXEC} ENV PATH=$PATH:${SBBSEXEC}
VOLUME [ "/var/lib/zerotier-one" ]
VOLUME [ "/opt/sbbs/data","/opt/sbbs/ctrl","/opt/sbbs/nodes","/opt/sbbs/fido","/opt/sbbs/text" ]
COPY logrotate.d /etc/logrotate.d/
COPY supervisord.d /etc/supervisor/conf.d/
COPY init /sbin/init COPY init /sbin/init
ENTRYPOINT [ "/sbin/init" ] ENTRYPOINT [ "/sbin/init" ]
CMD ["sbbs"] CMD ["sbbs"]
VOLUME [ "/var/lib/zerotier-one" ]
VOLUME [ "/opt/sbbs/data","/opt/sbbs/ctrl","/opt/sbbs/nodes","/opt/sbbs/fido" ]
# Set the default timezone for the container
RUN ln -sf /usr/share/zoneinfo/Australia/Melbourne /etc/localtime

12
init
View File

@ -7,12 +7,17 @@ export PATH=$PATH:${SBBSEXEC}
if [ ! -e "${SBBSCTRL}/sbbs.ini" ]; then if [ ! -e "${SBBSCTRL}/sbbs.ini" ]; then
echo "* Installing SBBS ctrl files into ${SBBSCTRL}" echo "* Installing SBBS ctrl files into ${SBBSCTRL}"
cp -a ${SBBSCTRL}.orig/* ${SBBSCTRL} cp -Ras ${SBBSCTRL}.orig/* ${SBBSCTRL}
fi fi
if [ ! -d "${SBBSCTRL}/../nodes/node1" ]; then if [ ! -d "${SBBSCTRL}/../nodes/node1" ]; then
echo "* Installing SBBS nodes files into ${SBBSCTRL}/../nodes" echo "* Installing SBBS nodes files into ${SBBSCTRL}/../nodes"
cp -Ra ${SBBSCTRL}/../nodes.orig/* ${SBBSCTRL}/../nodes/ cp -Ras ${SBBSCTRL}/../nodes.orig/* ${SBBSCTRL}/../nodes/
fi
if [ ! -e "${SBBSCTRL}/../text/answer.msg" ]; then
echo "* Installing SBBS text files into ${SBBSCTRL}/../text"
cp -Ras ${SBBSCTRL}/../text.orig/* ${SBBSCTRL}/../text/
fi fi
if [ -x /usr/sbin/zerotier-one -a -n "${ENABLE_ZT}" ]; then if [ -x /usr/sbin/zerotier-one -a -n "${ENABLE_ZT}" ]; then
@ -21,4 +26,7 @@ if [ -x /usr/sbin/zerotier-one -a -n "${ENABLE_ZT}" ]; then
/usr/sbin/zerotier-one -d /usr/sbin/zerotier-one -d
fi fi
# Start Supervisord
/usr/bin/supervisord -c /etc/supervisor/supervisord.conf
exec "$@" exec "$@"

10
logrotate.d/sbbsecho Normal file
View File

@ -0,0 +1,10 @@
/opt/sbbs/data/*.log {
daily
compress
rotate 31
dateext
olddir /opt/sbbs/data/old
missingok
createolddir 775 root root
notifempty
}

2
supervisord.d/cron.conf Normal file
View File

@ -0,0 +1,2 @@
[program:cron]
command=/usr/sbin/cron -f