server-mga9/Dockerfile
2024-08-27 00:51:42 +02:00

84 lines
5.1 KiB
Docker

# Rx3 Server Mageia-9 Docker Image
#-------------------------------------------------------------------------------
ARG IMG_URL_PREFIX="rx3"
FROM ${IMG_URL_PREFIX}/base-mga9:1.2.3
ARG IMG_NAME
ARG IMG_FULL_NAME
ARG IMG_VERSION
ARG IMG_MAINTAINER
LABEL org.rx3.${IMG_NAME}.name=${IMG_FULL_NAME}
LABEL org.rx3.${IMG_NAME}.version=${IMG_VERSION}
LABEL org.rx3.${IMG_NAME}.maintainer=${IMG_MAINTAINER}
LABEL maintainer=${IMG_MAINTAINER}
#---------------------------------------------------------------------------------------------------
ARG INIT_SHELL='#!/bin/bash \n\
\n\
function log() { echo "$(date --rfc-3339=ns) Init: $*" | tee -a /var/log/init.log; } \n\
\n\
log "Starting" \n\
\n\
for pgm in /etc/rcD.d/* \n\
do \n\
if [[ -r ${pgm} ]] \n\
then \n\
if [[ ${pgm##*/} == S99* ]] \n\
then \n\
log "Executing: [${pgm##*/}]" \n\
log "Completed" \n\
exec ${pgm} \n\
else \n\
log "Calling: [${pgm##*/}]" \n\
${pgm} \n\
fi \n\
fi \n\
done'
#---------------------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------------
ARG SUPERVISORD_INI='[inet_http_server] \n\
port=*:9001 \n\
\n\
[supervisord] \n\
nodaemon=true \n\
user=root'
#---------------------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------------
ARG CROND_INI='[program:crond] \n\
command=crond -n'
#---------------------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------------
ARG SUPERVISORD='#!/bin/bash \n\
\n\
exec supervisord -c /etc/supervisord.conf'
#---------------------------------------------------------------------------------------------------
RUN urpmi --force supervisor \
&& echo -e "${INIT_SHELL}" | sed -e 's/ *$//' >/usr/local/sbin/init.sh \
&& chmod a+x /usr/local/sbin/init.sh \
&& mkdir /etc/rc.d/rcD.d \
&& ln -s /etc/rc.d/rcD.d /etc \
&& echo -e "${SUPERVISORD_INI}" | sed -e 's/ *$//' > /etc/supervisord.d/supervisord.ini \
&& echo -e "${CROND_INI}" | sed -e 's/ *$//' > /etc/supervisord.d/crond.ini \
&& echo -e "${SUPERVISORD}" | sed -e 's/ *$//' > /etc/init.d/supervisord \
&& chmod a+x /etc/init.d/supervisord \
&& ln -s /etc/init.d/supervisord /etc/rcD.d/S99supervisord
EXPOSE 9001
CMD []
ENTRYPOINT ["init.sh"]