diff --git a/Dockerfile b/Dockerfile index b22f6be..b7fba5d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,17 @@ -# Rx3 Server Mageia-9 Docker Image +# Rx3-Docker/Server Docker Image #------------------------------------------------------------------------------- -ARG IMG_URL_PREFIX="rx3" - -FROM ${IMG_URL_PREFIX}/base-mga9:1.2.6 - ARG IMG_NAME -ARG IMG_FULL_NAME +ARG IMG_NAME_FULL ARG IMG_VERSION ARG IMG_MAINTAINER +ARG IMG_FROM_URL -LABEL org.rx3.${IMG_NAME}.name=${IMG_FULL_NAME} +ARG SERVER_PORT_SV_INT + +FROM ${IMG_FROM_URL} + +LABEL org.rx3.${IMG_NAME}.name=${IMG_NAME_FULL} LABEL org.rx3.${IMG_NAME}.version=${IMG_VERSION} LABEL org.rx3.${IMG_NAME}.maintainer=${IMG_MAINTAINER} LABEL maintainer=${IMG_MAINTAINER} @@ -41,6 +42,21 @@ do done' #--------------------------------------------------------------------------------------------------- +#--------------------------------------------------------------------------------------------------- +ARG SUPERVISORD='#!/bin/bash \n\ + \n\ +exec supervisord -c /etc/supervisord.conf' +#--------------------------------------------------------------------------------------------------- + +#--------------------------------------------------------------------------------------------------- +ARG CROND='#!/bin/bash \n\ + \n\ +if [[ "${SERVER_CROND_ENABLED}" != "TRUE" ]] \n\ +then \n\ + mv /etc/supervisord.d/crond.ini /etc/supervisord.d/crond.ini.disabled \n\ +fi' +#--------------------------------------------------------------------------------------------------- + #--------------------------------------------------------------------------------------------------- ARG SUPERVISORD_INI='[inet_http_server] \n\ port=*:9001 \n\ @@ -50,18 +66,11 @@ nodaemon=true 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 \ @@ -69,14 +78,17 @@ RUN urpmi --force supervisor && 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/\`/'/g" -e 's/ *$//' > /etc/supervisord.d/supervisord.ini \ - && echo -e "${CROND_INI}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/supervisord.d/crond.ini \ - && echo -e "${SUPERVISORD}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/init.d/supervisord \ + && echo -e "${CROND}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/init.d/crond \ + && echo -e "${SUPERVISORD}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/init.d/supervisord \ + && chmod a+x /etc/init.d/crond \ && chmod a+x /etc/init.d/supervisord \ - && ln -s /etc/init.d/supervisord /etc/rcD.d/S99supervisord + && ln -s /etc/init.d/crond /etc/rcD.d/S60crond \ + && ln -s /etc/init.d/supervisord /etc/rcD.d/S99supervisord \ + && echo -e "${CROND_INI}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/supervisord.d/crond.ini \ + && echo -e "${SUPERVISORD_INI}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/supervisord.d/supervisord.ini -EXPOSE 9001 +EXPOSE ${SERVER_PORT_SV_INT} CMD [] ENTRYPOINT ["init.sh"] diff --git a/ReadMe.txt b/ReadMe.txt index 2eab9ab..16df47e 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -1,14 +1,15 @@ -Welcome to Rx3/Server-Mga9 docker image! +Welcome to Rx3-Docker/Server docker image! -This is project aims to build a Mageia-9 server docker image to be used by others Rx3 packaging projects. +This project aims to build a Mageia server docker image to be used by other Rx3 packaging projects. Features: - - Curtently based on rx3/base-mga9:1.2.6 image, + - Curtently based on rx3-docker/base:1.3.0-mga9 image, - Init script calling in order sub scripts in /etc/init.d & /etc/rcD.d, - supervisord managing services, - - crond & logrotate configured. + - crond & logrotate configured, + - crond disabled by default. Enjoy it! @@ -16,4 +17,4 @@ Enjoy it! Your Rx3 Team. arnaud@rx3.net -https://git.rx3.org/gitea/rx3/server-mga9 +https://git.rx3.org/gitea/rx3-docker/server diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt index 7cc512b..b4ec403 100644 --- a/ReleaseNotes.txt +++ b/ReleaseNotes.txt @@ -1,3 +1,15 @@ +------------------------------------------------------------------------------------------------------------------------------------ +Rx3-Docker/Server V 1.2.0 - A. GIBERT - 2024/11/10 +------------------------------------------------------------------------------------------------------------------------------------ + +- Move & Rename repo from Rx3/Server-MGA9 to Rx3-Docker/Server, +- New version naming standard, +- Now use docker_tools for .env building, +- Use now rx3-docker/base:1.3.0-mga9 image, +- Add crond enabling via SERVER_CROND_ENABLE environement variable. + + + ------------------------------------------------------------------------------------------------------------------------------------ Rx3/Server-Mga9 V 1.1.3 - A. GIBERT - 2024/10/05 ------------------------------------------------------------------------------------------------------------------------------------ diff --git a/compose.yaml b/compose.yaml index 3a53c96..3c1072e 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,4 +1,4 @@ -# Rx3 Server Mageia-9 Docker Image +# Rx3-Docker/Server Docker Image #------------------------------------------------------------------------------- name: ${IMG_NAME} @@ -7,19 +7,25 @@ services: server: container_name: ${IMG_NAME} + hostname: ${IMG_NAME} - image: ${IMG_URL} + image: ${IMG_URL} build: context: . args: - IMG_NAME=${IMG_NAME} - - IMG_FULL_NAME=${IMG_FULL_NAME} + - IMG_NAME_FULL=${IMG_NAME_FULL} - IMG_VERSION=${IMG_VERSION} - IMG_MAINTAINER=${IMG_MAINTAINER} - - IMG_URL_PREFIX=${IMG_URL_PREFIX} + - IMG_FROM_URL=${IMG_FROM_URL} + + - SERVER_PORT_SV_INT=${SERVER_PORT_SV_INT} restart: unless-stopped + environment: + SERVER_CROND_ENABLED: ${SERVER_CROND_ENABLED} + ports: - - "127.0.0.1:${SERVER_SV_PORT}:9001" + - "127.0.0.1:${SERVER_PORT_SV_EXT}:${SERVER_PORT_SV_INT}" diff --git a/env b/env.dist similarity index 61% rename from env rename to env.dist index 49892f8..abf93db 100644 --- a/env +++ b/env.dist @@ -1,13 +1,14 @@ -# Rx3 Server Mageia-9 Docker Image +# Rx3-Docker/Server Docker Image #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # Global Settings #------------------------------------------------------------------------------- -IMG_ORG="rx3" -IMG_REGISTRY="docker.xor.rx3:5000" -IMG_URL_PREFIX="${IMG_REGISTRY}/${IMG_ORG}" +ORG_NAME="rx3-docker" +ORG_REGISTRY="docker.xor.rx3:5000" + +ORG_URL_PREFIX="${ORG_REGISTRY}/${ORG_NAME}" @@ -15,12 +16,16 @@ IMG_URL_PREFIX="${IMG_REGISTRY}/${IMG_ORG}" # Image Settings #------------------------------------------------------------------------------- -IMG_NAME="server-mga9" -IMG_FULL_NAME="Rx3 Server Mageia-9 Docker Image" -IMG_VERSION="1.1.3" -IMG_URL="${IMG_URL_PREFIX}/${IMG_NAME}:${IMG_VERSION}" +IMG_NAME="server" +IMG_NAME_FULL="Rx3-Docker/Server Docker Image" +IMG_VERSION="1.2.0-mga9" IMG_MAINTAINER='"Arnaud G. GIBERT" ' +IMG_URL_PREFIX="${ORG_URL_PREFIX}" +IMG_URL="${IMG_URL_PREFIX}/${IMG_NAME}:${IMG_VERSION}" + +IMG_FROM_URL="${ORG_URL_PREFIX}/base:1.3.0-mga9" + #------------------------------------------------------------------------------- @@ -30,6 +35,9 @@ IMG_MAINTAINER='"Arnaud G. GIBERT" ' ENV_PORT_OFFSET=0 SV_PORT_OFFSET=1000 -SERVER_PORT=$(( 8080 + ${ENV_PORT_OFFSET})) -SERVER_SV_PORT=$(( ${SERVER_PORT} + ${SV_PORT_OFFSET})) +SERVER_PORT_MAIN_EXT=$(( 8080 + ${ENV_PORT_OFFSET})) +SERVER_PORT_SV_EXT=$(( ${SERVER_PORT_MAIN_EXT} + ${SV_PORT_OFFSET})) +SERVER_PORT_SV_INT=9001 + +SERVER_CROND_ENABLED="FALSE"