diff --git a/Dockerfile b/Dockerfile index 0ea8a01..0a03c3c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/linuxserver/baseimage-alpine:3.15 +FROM ghcr.io/linuxserver/baseimage-alpine:3.16 # set version label ARG BUILD_DATE @@ -10,7 +10,6 @@ LABEL maintainer="alex-phillips" RUN \ echo "**** install build packages ****" && \ apk add --no-cache --upgrade --virtual=build-dependencies \ - curl \ cargo \ gcc \ git \ @@ -48,7 +47,7 @@ RUN \ rm -rf /usr/lib/python*/ensurepip && \ cd /app/netbox && \ pip3 install --no-cache-dir -U pip wheel && \ - pip3 install --no-cache-dir --ignore-installed --find-links https://wheel-index.linuxserver.io/alpine-3.15/ -r requirements.txt && \ + pip3 install --no-cache-dir --ignore-installed --find-links https://wheel-index.linuxserver.io/alpine-3.16/ -r requirements.txt && \ echo "**** cleanup ****" && \ apk del --purge \ build-dependencies && \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 8250070..c69cec5 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -1,4 +1,4 @@ -FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.15 +FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.16 # set version label ARG BUILD_DATE @@ -10,7 +10,6 @@ LABEL maintainer="alex-phillips" RUN \ echo "**** install build packages ****" && \ apk add --no-cache --upgrade --virtual=build-dependencies \ - curl \ cargo \ gcc \ git \ @@ -48,7 +47,7 @@ RUN \ rm -rf /usr/lib/python*/ensurepip && \ cd /app/netbox && \ pip3 install --no-cache-dir -U pip wheel && \ - pip3 install --no-cache-dir --ignore-installed --find-links https://wheel-index.linuxserver.io/alpine-3.15/ -r requirements.txt && \ + pip3 install --no-cache-dir --ignore-installed --find-links https://wheel-index.linuxserver.io/alpine-3.16/ -r requirements.txt && \ echo "**** cleanup ****" && \ apk del --purge \ build-dependencies && \ diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 32b0e6a..dc509c8 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -1,4 +1,4 @@ -FROM ghcr.io/linuxserver/baseimage-alpine:arm32v7-3.15 +FROM ghcr.io/linuxserver/baseimage-alpine:arm32v7-3.16 # set version label ARG BUILD_DATE @@ -10,7 +10,6 @@ LABEL maintainer="alex-phillips" RUN \ echo "**** install build packages ****" && \ apk add --no-cache --upgrade --virtual=build-dependencies \ - curl \ cargo \ gcc \ git \ @@ -48,7 +47,7 @@ RUN \ rm -rf /usr/lib/python*/ensurepip && \ cd /app/netbox && \ pip3 install --no-cache-dir -U pip wheel && \ - pip3 install --no-cache-dir --ignore-installed --find-links https://wheel-index.linuxserver.io/alpine-3.15/ -r requirements.txt && \ + pip3 install --no-cache-dir --ignore-installed --find-links https://wheel-index.linuxserver.io/alpine-3.16/ -r requirements.txt && \ echo "**** cleanup ****" && \ apk del --purge \ build-dependencies && \ diff --git a/README.md b/README.md index 2c979ec..74aee8a 100644 --- a/README.md +++ b/README.md @@ -283,6 +283,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **02.11.22:** - Rebase to Alpine 3.16, migrate to s6v3. * **01.08.22:** - Remove py3-pillow, add tiff to fix deps. * **26.07.22:** - Add py3-pillow package back on arm to fix build issue. * **10.12.21:** - Remove py3-pillow package to fix dependency issue with 3.2.0. diff --git a/readme-vars.yml b/readme-vars.yml index 7462610..3afde80 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -59,6 +59,7 @@ app_setup_block: | # changelog changelogs: + - { date: "02.11.22:", desc: "Rebase to Alpine 3.16, migrate to s6v3." } - { date: "01.08.22:", desc: "Remove py3-pillow, add tiff to fix deps." } - { date: "26.07.22:", desc: "Add py3-pillow package back on arm to fix build issue." } - { date: "10.12.21:", desc: "Remove py3-pillow package to fix dependency issue with 3.2.0." } diff --git a/root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-netbox-config b/root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-netbox-config new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/s6-overlay/s6-rc.d/init-netbox-config/dependencies.d/init-config b/root/etc/s6-overlay/s6-rc.d/init-netbox-config/dependencies.d/init-config new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/cont-init.d/50-config b/root/etc/s6-overlay/s6-rc.d/init-netbox-config/run old mode 100644 new mode 100755 similarity index 79% rename from root/etc/cont-init.d/50-config rename to root/etc/s6-overlay/s6-rc.d/init-netbox-config/run index b6eb97e..505d1c8 --- a/root/etc/cont-init.d/50-config +++ b/root/etc/s6-overlay/s6-rc.d/init-netbox-config/run @@ -22,20 +22,22 @@ NETBOX_CONF[REMOTE_AUTH_AUTO_CREATE_USER]=${REMOTE_AUTH_AUTO_CREATE_USER:-False} NETBOX_CONF[REMOTE_AUTH_DEFAULT_GROUPS]=${REMOTE_AUTH_DEFAULT_GROUPS:-[]} NETBOX_CONF[REMOTE_AUTH_DEFAULT_PERMISSIONS]=${REMOTE_AUTH_DEFAULT_PERMISSIONS:-{}} -cd /app/netbox/netbox/netbox +cd /app/netbox/netbox/netbox || exit 1 + NETBOX_CONF[SECRET_KEY]=${SECRET_KEY:-$(python3 ../generate_secret_key.py)} -if [ ! -f "/config/configuration.py" ]; then - cp /defaults/configuration.py /config/configuration.py +if [[ ! -f "/config/configuration.py" ]]; then + cp /defaults/configuration.py /config/configuration.py - # sed in values or skip if value not set - for KEY in "${!NETBOX_CONF[@]}"; do \ - sed -i 's|{{'$KEY'}}|'${NETBOX_CONF[$KEY]}'|g' /config/configuration.py - done + # sed in values or skip if value not set + for KEY in "${!NETBOX_CONF[@]}"; do \ + sed -i 's|{{'$KEY'}}|'${NETBOX_CONF[$KEY]}'|g' /config/configuration.py + done fi -[[ ! -e "/config/media" ]] && \ - mv /app/netbox/netbox/media /config/media +if [[ ! -e "/config/media" ]]; then + mv /app/netbox/netbox/media /config/media +fi rm -rf /app/netbox/netbox/media ln -sf /config/media /app/netbox/netbox/media @@ -46,14 +48,14 @@ mv /defaults/uwsgi.ini /app/netbox/netbox/uwsgi.ini > /dev/null 2>&1 # permissions chown -R abc:abc \ - /app/netbox \ - /config + /app/netbox \ + /config cd /app/netbox || exit s6-setuidgid abc /usr/bin/python3 netbox/manage.py migrate -if [ -n "$SUPERUSER_EMAIL" ] && [ -n "$SUPERUSER_PASSWORD" ]; +if [[ -n "$SUPERUSER_EMAIL" ]] && [[ -n "$SUPERUSER_PASSWORD" ]]; then cat << EOF | s6-setuidgid abc python3 /app/netbox/netbox/manage.py shell from django.contrib.auth.models import User; diff --git a/root/etc/s6-overlay/s6-rc.d/init-netbox-config/type b/root/etc/s6-overlay/s6-rc.d/init-netbox-config/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-netbox-config/type @@ -0,0 +1 @@ +oneshot diff --git a/root/etc/s6-overlay/s6-rc.d/init-netbox-config/up b/root/etc/s6-overlay/s6-rc.d/init-netbox-config/up new file mode 100644 index 0000000..fe86ca8 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-netbox-config/up @@ -0,0 +1 @@ +/etc/s6-overlay/s6-rc.d/init-netbox-config/run diff --git a/root/etc/s6-overlay/s6-rc.d/svc-netbox/dependencies.d/init-services b/root/etc/s6-overlay/s6-rc.d/svc-netbox/dependencies.d/init-services new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/s6-overlay/s6-rc.d/svc-netbox/notification-fd b/root/etc/s6-overlay/s6-rc.d/svc-netbox/notification-fd new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/svc-netbox/notification-fd @@ -0,0 +1 @@ +3 diff --git a/root/etc/s6-overlay/s6-rc.d/svc-netbox/run b/root/etc/s6-overlay/s6-rc.d/svc-netbox/run new file mode 100755 index 0000000..4229fb9 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/svc-netbox/run @@ -0,0 +1,5 @@ +#!/usr/bin/with-contenv bash + +exec \ + s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 8000" \ + cd /app/netbox/netbox s6-setuidgid abc /usr/sbin/uwsgi uwsgi.ini diff --git a/root/etc/s6-overlay/s6-rc.d/svc-netbox/type b/root/etc/s6-overlay/s6-rc.d/svc-netbox/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/svc-netbox/type @@ -0,0 +1 @@ +longrun diff --git a/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-netbox-config b/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-netbox-config new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-netbox b/root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-netbox new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/services.d/netbox/run b/root/etc/services.d/netbox/run deleted file mode 100755 index 763ef74..0000000 --- a/root/etc/services.d/netbox/run +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/with-contenv bash - -cd /app/netbox/netbox || exit - -exec \ - s6-setuidgid abc /usr/sbin/uwsgi uwsgi.ini