diff --git a/Dockerfile b/Dockerfile index f76f641..dbd4ae0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,6 @@ -FROM ghcr.io/linuxserver/baseimage-alpine:3.15 +# syntax=docker/dockerfile:1 + +FROM ghcr.io/linuxserver/baseimage-alpine:3.17 # set version label ARG BUILD_DATE @@ -19,24 +21,24 @@ RUN \ apk add --no-cache \ libffi \ libldap \ - py3-pip \ python3 && \ if [ -z ${LDAP_VERSION+x} ]; then \ - LDAP_INSTALL="python-ldap"; \ - else \ - LDAP_INSTALL="python-ldap==${LDAP_VERSION}"; \ + LDAP_VERSION=$(curl -sL https://pypi.python.org/pypi/python-ldap/json |jq -r '. | .info.version'); \ fi && \ - pip3 install -U --no-cache-dir pip setuptools wheel && \ - pip install -U --no-cache-dir --find-links https://wheel-index.linuxserver.io/alpine-3.15/ \ + python3 -m ensurepip && \ + pip3 install -U --no-cache-dir \ + pip \ + wheel && \ + pip3 install -U --no-cache-dir --find-links https://wheel-index.linuxserver.io/alpine-3.17/ \ cryptography \ - ${LDAP_INSTALL} && \ + python-ldap=="${LDAP_VERSION}" && \ echo "**** cleanup ****" && \ apk del --purge \ build-dependencies && \ rm -rf \ /tmp/* \ - /root/.cache \ - /root/.cargo + $HOME/.cache \ + $HOME/.cargo # copy local files COPY root/ / diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 2d42deb..098301a 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -1,4 +1,6 @@ -FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.15 +# syntax=docker/dockerfile:1 + +FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.17 # set version label ARG BUILD_DATE @@ -19,24 +21,24 @@ RUN \ apk add --no-cache \ libffi \ libldap \ - py3-pip \ python3 && \ if [ -z ${LDAP_VERSION+x} ]; then \ - LDAP_INSTALL="python-ldap"; \ - else \ - LDAP_INSTALL="python-ldap==${LDAP_VERSION}"; \ + LDAP_VERSION=$(curl -sL https://pypi.python.org/pypi/python-ldap/json |jq -r '. | .info.version'); \ fi && \ - pip3 install -U --no-cache-dir pip setuptools wheel && \ - pip install -U --no-cache-dir --find-links https://wheel-index.linuxserver.io/alpine-3.15/ \ + python3 -m ensurepip && \ + pip3 install -U --no-cache-dir \ + pip \ + wheel && \ + pip3 install -U --no-cache-dir --find-links https://wheel-index.linuxserver.io/alpine-3.17/ \ cryptography \ - ${LDAP_INSTALL} && \ + python-ldap=="${LDAP_VERSION}" && \ echo "**** cleanup ****" && \ apk del --purge \ build-dependencies && \ rm -rf \ /tmp/* \ - /root/.cache \ - /root/.cargo + $HOME/.cache \ + $HOME/.cargo # copy local files COPY root/ / diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 4c3a0bf..40d4aa4 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -1,4 +1,6 @@ -FROM ghcr.io/linuxserver/baseimage-alpine:arm32v7-3.15 +# syntax=docker/dockerfile:1 + +FROM ghcr.io/linuxserver/baseimage-alpine:arm32v7-3.17 # set version label ARG BUILD_DATE @@ -19,24 +21,24 @@ RUN \ apk add --no-cache \ libffi \ libldap \ - py3-pip \ python3 && \ if [ -z ${LDAP_VERSION+x} ]; then \ - LDAP_INSTALL="python-ldap"; \ - else \ - LDAP_INSTALL="python-ldap==${LDAP_VERSION}"; \ + LDAP_VERSION=$(curl -sL https://pypi.python.org/pypi/python-ldap/json |jq -r '. | .info.version'); \ fi && \ - pip3 install -U --no-cache-dir pip setuptools wheel && \ - pip install -U --no-cache-dir --find-links https://wheel-index.linuxserver.io/alpine-3.15/ \ + python3 -m ensurepip && \ + pip3 install -U --no-cache-dir \ + pip \ + wheel && \ + pip3 install -U --no-cache-dir --find-links https://wheel-index.linuxserver.io/alpine-3.17/ \ cryptography \ - ${LDAP_INSTALL} && \ + python-ldap=="${LDAP_VERSION}" && \ echo "**** cleanup ****" && \ apk del --purge \ build-dependencies && \ rm -rf \ /tmp/* \ - /root/.cache \ - /root/.cargo + $HOME/.cache \ + $HOME/.cargo # copy local files COPY root/ / diff --git a/readme-vars.yml b/readme-vars.yml index b688e98..933df94 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -43,6 +43,7 @@ app_setup_block: | # changelog changelogs: + - { date: "19.09.22:", desc: "Rebase to alpine 3.17." } - { date: "19.09.22:", desc: "Rebase to alpine 3.15." } - { date: "14.05.21:", desc: "Add linuxserver wheel index." } - { date: "12.02.21:", desc: "Clean up cargo/rust cache." } diff --git a/root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-ldap-config b/root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-ldap-config new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/s6-overlay/s6-rc.d/init-ldap-config/dependencies.d/init-config b/root/etc/s6-overlay/s6-rc.d/init-ldap-config/dependencies.d/init-config new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/cont-init.d/30-config b/root/etc/s6-overlay/s6-rc.d/init-ldap-config/run old mode 100644 new mode 100755 similarity index 95% rename from root/etc/cont-init.d/30-config rename to root/etc/s6-overlay/s6-rc.d/init-ldap-config/run index b9732ae..58ace5d --- a/root/etc/cont-init.d/30-config +++ b/root/etc/s6-overlay/s6-rc.d/init-ldap-config/run @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bash +# shellcheck shell=bash # generate fernet key for ldap if it doesn't exist if grep -q 'REPLACEWITHFERNETKEY' /app/ldap-backend-app.py; then @@ -13,7 +14,7 @@ if grep -q 'REPLACEWITHFERNETKEY' /app/ldap-backend-app.py; then KEY="b'${FERNETKEY}'" echo "using FERNETKEY from env variable" fi - + sed -i "s/REPLACEWITHFERNETKEY/${KEY}/" /app/ldap-backend-app.py - sed -i "s/REPLACEWITHFERNETKEY/${KEY}/" /app/nginx-ldap-auth-daemon.py + sed -i "s/REPLACEWITHFERNETKEY/${KEY}/" /app/nginx-ldap-auth-daemon.py fi diff --git a/root/etc/s6-overlay/s6-rc.d/init-ldap-config/type b/root/etc/s6-overlay/s6-rc.d/init-ldap-config/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-ldap-config/type @@ -0,0 +1 @@ +oneshot diff --git a/root/etc/s6-overlay/s6-rc.d/init-ldap-config/up b/root/etc/s6-overlay/s6-rc.d/init-ldap-config/up new file mode 100644 index 0000000..41c2cf8 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-ldap-config/up @@ -0,0 +1 @@ +/etc/s6-overlay/s6-rc.d/init-ldap-config/run diff --git a/root/etc/s6-overlay/s6-rc.d/svc-ldap-app/dependencies.d/init-services b/root/etc/s6-overlay/s6-rc.d/svc-ldap-app/dependencies.d/init-services new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/s6-overlay/s6-rc.d/svc-ldap-app/notification-fd b/root/etc/s6-overlay/s6-rc.d/svc-ldap-app/notification-fd new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/svc-ldap-app/notification-fd @@ -0,0 +1 @@ +3 diff --git a/root/etc/s6-overlay/s6-rc.d/svc-ldap-app/run b/root/etc/s6-overlay/s6-rc.d/svc-ldap-app/run new file mode 100755 index 0000000..f4e81f2 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/svc-ldap-app/run @@ -0,0 +1,7 @@ +#!/usr/bin/with-contenv bash +# shellcheck shell=bash + +exec \ + s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 9000" \ + s6-setuidgid abc python3 /app/ldap-backend-app.py \ + --host 0.0.0.0 --port 9000 diff --git a/root/etc/s6-overlay/s6-rc.d/svc-ldap-app/type b/root/etc/s6-overlay/s6-rc.d/svc-ldap-app/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/svc-ldap-app/type @@ -0,0 +1 @@ +longrun diff --git a/root/etc/s6-overlay/s6-rc.d/svc-ldap-daemon/dependencies.d/init-services b/root/etc/s6-overlay/s6-rc.d/svc-ldap-daemon/dependencies.d/init-services new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/s6-overlay/s6-rc.d/svc-ldap-daemon/notification-fd b/root/etc/s6-overlay/s6-rc.d/svc-ldap-daemon/notification-fd new file mode 100644 index 0000000..b8626c4 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/svc-ldap-daemon/notification-fd @@ -0,0 +1 @@ +4 diff --git a/root/etc/s6-overlay/s6-rc.d/svc-ldap-daemon/run b/root/etc/s6-overlay/s6-rc.d/svc-ldap-daemon/run new file mode 100755 index 0000000..27d53d8 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/svc-ldap-daemon/run @@ -0,0 +1,7 @@ +#!/usr/bin/with-contenv bash +# shellcheck shell=bash + +exec \ + s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 8888" \ + s6-setuidgid abc python3 /app/nginx-ldap-auth-daemon.py \ + --host 0.0.0.0 --port 8888 diff --git a/root/etc/s6-overlay/s6-rc.d/svc-ldap-daemon/type b/root/etc/s6-overlay/s6-rc.d/svc-ldap-daemon/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/svc-ldap-daemon/type @@ -0,0 +1 @@ +longrun diff --git a/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-ldap-config b/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-ldap-config new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-ldap-app b/root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-ldap-app new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-ldap-daemon b/root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-ldap-daemon new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/services.d/ldap-app/run b/root/etc/services.d/ldap-app/run deleted file mode 100644 index 94e382d..0000000 --- a/root/etc/services.d/ldap-app/run +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/with-contenv bash - -exec \ - s6-setuidgid abc python3 /app/ldap-backend-app.py \ - --host 0.0.0.0 --port 9000 diff --git a/root/etc/services.d/ldap-daemon/run b/root/etc/services.d/ldap-daemon/run deleted file mode 100644 index 8c05a64..0000000 --- a/root/etc/services.d/ldap-daemon/run +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/with-contenv bash - -exec \ - s6-setuidgid abc python3 /app/nginx-ldap-auth-daemon.py \ - --host 0.0.0.0 --port 8888