diff --git a/.circleci/config.yml b/.circleci/config.yml index 8c95e0d..fe4e951 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -42,7 +42,7 @@ version: 2.1 executors: testbuild-executor: machine: - image: ubuntu-2004:202201-02 + image: default jobs: test: executor: testbuild-executor diff --git a/Dockerfile b/Dockerfile index 7d58fce..01a4b96 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,24 +1,32 @@ FROM ubuntu:24.04 LABEL maintainer="LanCache.Net Team " -ARG DEBIAN_FRONTEND=noninteractive -RUN \ - apt-get -y update && apt-get -y upgrade && \ - apt-get -y install supervisor curl wget bzip2 locales tzdata --no-install-recommends && \ - locale-gen en_GB.utf8 && \ - update-locale LANG=en_GB.utf8 && \ - apt-get -y clean && \ - rm -rf /var/lib/apt/lists/* +ARG DEBIAN_FRONTEND=noninteractive +ARG ARCH="amd64" +ARG ARCH_ALT="x86_64" +ARG OVERLAY_VERSION="3.2.0.0" ENV \ - SUPERVISORD_EXIT_ON_FATAL=1 \ - LC_ALL=en_GB.UTF-8 \ - LANG=en_GB.UTF-8 \ - LANGUAGE=en_GB.UTF-8 \ - TZ=Europe/London \ - SUPERVISORD_LOGLEVEL=WARN + S6_BEHAVIOUR_IF_STAGE2_FAILS=2 \ + S6_VERBOSITY=1 \ + LC_ALL=en_GB.UTF-8 \ + LANG=en_GB.UTF-8 \ + LANGUAGE=en_GB.UTF-8 \ + 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 ca-certificates curl locales tzdata wget xz-utils --no-install-recommends && \ + locale-gen en_GB.utf8 && \ + update-locale LANG=en_GB.utf8 \ + cd /tmp && \ + curl -sSfL -o s6-overlay-noarch.tar.xz "https://github.com/just-containers/s6-overlay/releases/download/v${OVERLAY_VERSION}/s6-overlay-noarch.tar.xz" && \ + curl -sSfL -o s6-overlay.tar.xz "https://github.com/just-containers/s6-overlay/releases/download/v${OVERLAY_VERSION}/s6-overlay-${ARCH_ALT}.tar.xz" && \ + tar -C / -Jpxf s6-overlay-noarch.tar.xz && \ + tar -C / -Jpxf s6-overlay.tar.xz && \ + apt-get -y clean && \ + rm -rf /tmp/* /var/lib/apt/lists/* + +ENTRYPOINT ["/init"] diff --git a/goss.yaml b/goss.yaml index b4d2b90..de3fb7e 100644 --- a/goss.yaml +++ b/goss.yaml @@ -1,10 +1,8 @@ package: - bzip2: - installed: true curl: installed: true wget: installed: true process: - supervisord: + s6-svscan: running: true diff --git a/overlay/etc/supervisor/conf.d/.gitkeep b/overlay/etc/s6-overlay/s6-rc.d/asciilogo/dependencies.d/base similarity index 100% rename from overlay/etc/supervisor/conf.d/.gitkeep rename to overlay/etc/s6-overlay/s6-rc.d/asciilogo/dependencies.d/base diff --git a/overlay/etc/s6-overlay/s6-rc.d/asciilogo/type b/overlay/etc/s6-overlay/s6-rc.d/asciilogo/type new file mode 100644 index 0000000..3d92b15 --- /dev/null +++ b/overlay/etc/s6-overlay/s6-rc.d/asciilogo/type @@ -0,0 +1 @@ +oneshot \ No newline at end of file diff --git a/overlay/etc/s6-overlay/s6-rc.d/asciilogo/up b/overlay/etc/s6-overlay/s6-rc.d/asciilogo/up new file mode 100644 index 0000000..4789af4 --- /dev/null +++ b/overlay/etc/s6-overlay/s6-rc.d/asciilogo/up @@ -0,0 +1 @@ +/etc/s6-overlay/scripts/asciilogo \ No newline at end of file diff --git a/overlay/hooks/.gitkeep b/overlay/etc/s6-overlay/s6-rc.d/user/contents.d/asciilogo similarity index 100% rename from overlay/hooks/.gitkeep rename to overlay/etc/s6-overlay/s6-rc.d/user/contents.d/asciilogo diff --git a/overlay/etc/s6-overlay/scripts/asciilogo b/overlay/etc/s6-overlay/scripts/asciilogo new file mode 100755 index 0000000..ddc81f0 --- /dev/null +++ b/overlay/etc/s6-overlay/scripts/asciilogo @@ -0,0 +1,12 @@ +#!/command/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 5509a39..0000000 --- a/overlay/init/supervisord +++ /dev/null @@ -1,31 +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 - -echo "Starting Supervisord" - -exec /usr/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" $@