diff --git a/Dockerfile b/Dockerfile index 8699080..d1b6a12 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,25 +1,28 @@ FROM ubuntu:bionic MAINTAINER LanCache.Net Team + ARG DEBIAN_FRONTEND=noninteractive -RUN \ - apt-get -y update && apt-get -y upgrade && \ - apt-get -y install python3-pip curl wget bzip2 locales tzdata && \ - locale-gen en_GB.utf8 && \ - update-locale LANG=en_GB.utf8 -RUN \ - pip3 install supervisor && \ - mkdir --mode 777 -p /var/log/supervisor -RUN \ - apt-get -y clean && \ - rm -rf /var/lib/apt/lists/* +ARG ARCH="amd64" +ARG OVERLAY_VERSION="v2.2.0.3" + ENV \ - SUPERVISORD_EXIT_ON_FATAL=1 \ + S6_BEHAVIOUR_IF_STAGE2_FAILS=2 \ LC_ALL=en_GB.UTF-8 \ LANG=en_GB.UTF-8 \ LANGUAGE=en_GB.UTF-8 \ - TZ=Europe/London \ - SUPERVISORD_LOGLEVEL=WARN + TZ=Europe/London + COPY overlay/ / -RUN chmod -R 755 /init /hooks -ENTRYPOINT ["/bin/bash", "-e", "/init/entrypoint"] -CMD ["/init/supervisord"] + +RUN \ + apt-get -y update && apt-get -y upgrade && \ + apt-get -y install curl wget bzip2 locales tzdata && \ + locale-gen en_GB.utf8 && \ + update-locale LANG=en_GB.utf8 \ + cd /tmp && \ + curl -sSfL -o s6-overlay.tar.gz "https://github.com/just-containers/s6-overlay/releases/download/${OVERLAY_VERSION}/s6-overlay-${ARCH}.tar.gz" && \ + tar xfz s6-overlay.tar.gz -C / && \ + apt-get -y clean && \ + rm -rf /tmp/* /var/lib/apt/lists/* + +ENTRYPOINT ["/init"] diff --git a/goss.yaml b/goss.yaml index e56ed3e..d3269ae 100644 --- a/goss.yaml +++ b/goss.yaml @@ -3,10 +3,8 @@ package: installed: true curl: installed: true - python3-pip: - installed: true wget: installed: true process: - supervisord: + s6-svscan: running: true diff --git a/overlay/etc/cont-init.d/00-asciilogo b/overlay/etc/cont-init.d/00-asciilogo new file mode 100644 index 0000000..fb94a67 --- /dev/null +++ b/overlay/etc/cont-init.d/00-asciilogo @@ -0,0 +1,12 @@ +#!/usr/bin/with-contenv bash + +cat < /dev/null || true - -entrypoint_pre=$(ls /hooks/entrypoint-pre.d/* 2>/dev/null | sort -n ) -if [ "$entrypoint_pre" != "" ]; then - for hook in $entrypoint_pre; do - echo "Executing hook ${hook}" - /bin/bash -c "${hook}" - if [ "$?" != "0" ]; then - die "hook ${hook}} returned a non-zero exit status '$?'" - fi - done -fi - -[[ -f "/hooks/entrypoint-pre" ]] && echo "The /hooks/entrypoint-pre hook has been replaced with /hooks/entrypoint-pre.d/*" && exit 1 - -[[ -f "/init/setup" ]] && /init/setup - -eval ${SETUP:-} - -case ${1} in - run) - check_depending_env - [[ -f "/hooks/entrypoint-run" ]] && /hooks/entrypoint-run - if [[ -e /init/supervisord && -d /etc/supervisor ]]; then - # Use exec so we replace our current process so signals can get through - exec /bin/bash /init/supervisord - else - exec /bin/bash - fi - ;; - *) - [[ -f "/hooks/entrypoint-exec" ]] && /hooks/entrypoint-exec - exec $* - ;; -esac diff --git a/overlay/init/supervisord b/overlay/init/supervisord deleted file mode 100755 index f3f9ef7..0000000 --- a/overlay/init/supervisord +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -[ ${DOCKER_DEBUG} ] && set -x - -die () { - echo "ERROR: ${1}" - exit 1 -} - -# PID, trap, wait; all belongs to 'docker stop' signal handeling. -# This is the same logic as the parent docker container, but rather this, -# than creating a one-time process in supervisord to handle this logic. -PID=; trap '[[ ${PID} ]] && kill ${PID}; exit 0' SIGTERM - -supervisord_pre=$(ls /hooks/supervisord-pre.d/* 2>/dev/null | sort -n ) -if [ "$supervisord_pre" != "" ]; then - for hook in $supervisord_pre; do - echo "Executing hook ${hook}" - /bin/bash -c "${hook}" - if [ "$?" != "0" ]; then - die "hook ${hook}} returned a non-zero exit status '$?'" - fi - done -fi - -[[ -f "/hooks/supervisord-pre" ]] && echo "The /hooks/supervisord-pre hook has been replaced with /hooks/supervisord-pre.d/*" && exit 1 -#[ -f "/hooks/supervisord-pre" ] && /hooks/supervisord-pre - -exec /usr/local/bin/supervisord -n -c /etc/supervisor/supervisord.conf -e ${SUPERVISORD_LOGLEVEL:-error} diff --git a/run-tests.sh b/run-tests.sh index beffdf4..1136f21 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -1,9 +1,3 @@ #!/bin/bash -if [[ "$@" == *" -- "* ]]; then - SD_LOGLEVEL="-e SUPERVISORD_LOGLEVEL=INFO" -else - SD_LOGLEVEL="-- -e SUPERVISORD_LOGLEVEL=INFO" -fi - -curl -fsSL https://raw.githubusercontent.com/lancachenet/test-suite/master/dgoss-tests.sh | bash -s -- --imagename="lancachenet/ubuntu:goss-test" $@ $SD_LOGLEVEL +curl -fsSL https://raw.githubusercontent.com/lancachenet/test-suite/master/dgoss-tests.sh | bash -s -- --imagename="lancachenet/ubuntu:goss-test" $@