From 0bac538473af2b9e15c7a57cb315241f52f95515 Mon Sep 17 00:00:00 2001 From: varpon Date: Fri, 10 Apr 2026 14:56:19 +0000 Subject: [PATCH] automatically download latest version from upstream and from packages --- Containerfile | 16 +++++++++------- Containerfile.j2 | 16 +++++++++------- Containerfile.pkg | 15 ++++----------- Containerfile.pkg.j2 | 21 +++++++++------------ compose.yaml | 2 +- 5 files changed, 32 insertions(+), 38 deletions(-) diff --git a/Containerfile b/Containerfile index 45c15e3..a8bb7ce 100644 --- a/Containerfile +++ b/Containerfile @@ -8,10 +8,9 @@ ARG BASE_VERSION=15 FROM ghcr.io/daemonless/base:${BASE_VERSION} ARG FREEBSD_ARCH=amd64 -ARG PACKAGES="authelia" -ARG APP_VERSION="4.39.17" -ARG DOWNLOAD_URL="https://github.com/authelia/authelia/releases/download/v${APP_VERSION}/authelia-v${APP_VERSION}-freebsd-${FREEBSD_ARCH}.tar.gz" -ARG UPSTREAM_URL="https://github.com/authelia/authelia" +ARG PACKAGES="" +ARG UPSTREAM_URL="https://api.github.com/repos/authelia/authelia/releases/latest" +ARG UPSTREAM_JQ=".tag_name" ARG HEALTHCHECK_ENDPOINT="http://localhost:3000" LABEL org.opencontainers.image.title="Authelia" \ @@ -26,8 +25,8 @@ LABEL org.opencontainers.image.title="Authelia" \ io.daemonless.arch="${FREEBSD_ARCH}" \ io.daemonless.upstream-mode=github \ io.daemonless.upstream-repo=authelia/authelia \ -# io.daemonless.upstream-url="${UPSTREAM_URL}" \ -# io.daemonless.upstream-jq="${UPSTREAM_JQ}" \ + io.daemonless.upstream-url="${UPSTREAM_URL}" \ + io.daemonless.upstream-jq="${UPSTREAM_JQ}" \ io.daemonless.healthcheck-url="${HEALTHCHECK_ENDPOINT}" \ io.daemonless.wip="true" @@ -39,7 +38,10 @@ LABEL org.opencontainers.image.title="Authelia" \ # rm -rf /var/cache/pkg/* /var/db/pkg/repos/* # Download and install authelia -RUN fetch -qo /tmp/authelia.tar.gz "${DOWNLOAD_URL}" && \ +RUN APP_VERSION=$(fetch -qo - "${UPSTREAM_URL}" | \ + jq -r "${UPSTREAM_JQ}" | sed -n 's/v\(.*\)/\1/p') && \ + echo "Installing Authelia $APP_VERSION" && \ + fetch -qo /tmp/authelia.tar.gz "https://github.com/authelia/authelia/releases/download/v${APP_VERSION}/authelia-v${APP_VERSION}-freebsd-${FREEBSD_ARCH}.tar.gz" && \ mkdir -p /app && \ tar -xzf /tmp/authelia.tar.gz -C /app && \ rm /tmp/authelia.tar.gz && \ diff --git a/Containerfile.j2 b/Containerfile.j2 index e3e7bef..220ca84 100644 --- a/Containerfile.j2 +++ b/Containerfile.j2 @@ -2,10 +2,9 @@ ARG BASE_VERSION=15 FROM ghcr.io/daemonless/base:${BASE_VERSION} ARG FREEBSD_ARCH=amd64 -ARG PACKAGES="authelia" -ARG APP_VERSION="4.39.17" -ARG DOWNLOAD_URL="https://github.com/authelia/authelia/releases/download/v${APP_VERSION}/authelia-v${APP_VERSION}-freebsd-${FREEBSD_ARCH}.tar.gz" -ARG UPSTREAM_URL="https://github.com/authelia/authelia" +ARG PACKAGES="" +ARG UPSTREAM_URL="https://api.github.com/repos/authelia/authelia/releases/latest" +ARG UPSTREAM_JQ=".tag_name" ARG HEALTHCHECK_ENDPOINT="http://localhost:3000" LABEL org.opencontainers.image.title="{{ title }}" \ @@ -22,8 +21,8 @@ LABEL org.opencontainers.image.title="{{ title }}" \ io.daemonless.arch="${FREEBSD_ARCH}" \ io.daemonless.upstream-mode=github \ io.daemonless.upstream-repo=authelia/authelia \ -# io.daemonless.upstream-url="${UPSTREAM_URL}" \ -# io.daemonless.upstream-jq="${UPSTREAM_JQ}" \ + io.daemonless.upstream-url="${UPSTREAM_URL}" \ + io.daemonless.upstream-jq="${UPSTREAM_JQ}" \ io.daemonless.healthcheck-url="${HEALTHCHECK_ENDPOINT}" \ io.daemonless.wip="true" @@ -35,7 +34,10 @@ LABEL org.opencontainers.image.title="{{ title }}" \ # rm -rf /var/cache/pkg/* /var/db/pkg/repos/* # Download and install authelia -RUN fetch -qo /tmp/authelia.tar.gz "${DOWNLOAD_URL}" && \ +RUN APP_VERSION=$(fetch -qo - "${UPSTREAM_URL}" | \ + jq -r "${UPSTREAM_JQ}" | sed -n 's/v\(.*\)/\1/p') && \ + echo "Installing Authelia $APP_VERSION" && \ + fetch -qo /tmp/authelia.tar.gz "https://github.com/authelia/authelia/releases/download/v${APP_VERSION}/authelia-v${APP_VERSION}-freebsd-${FREEBSD_ARCH}.tar.gz" && \ mkdir -p /app && \ tar -xzf /tmp/authelia.tar.gz -C /app && \ rm /tmp/authelia.tar.gz && \ diff --git a/Containerfile.pkg b/Containerfile.pkg index 9c14546..d5e6881 100644 --- a/Containerfile.pkg +++ b/Containerfile.pkg @@ -9,7 +9,6 @@ FROM ghcr.io/daemonless/base:${BASE_VERSION} ARG FREEBSD_ARCH=amd64 ARG PACKAGES="authelia" -ARG APP_VERSION="latest" LABEL org.opencontainers.image.title="Authelia" \ org.opencontainers.image.description="Authelia on FreeBSD." \ @@ -30,23 +29,17 @@ LABEL org.opencontainers.image.title="Authelia" \ RUN pkg update && \ pkg install -y ${PACKAGES} && \ pkg clean -ay && \ + mkdir -p /app && pkg info authelia | sed -n 's/.*Version.*: *//p' > /app/version && \ rm -rf /var/cache/pkg/* /var/db/pkg/repos/* -# Download and install authelia -#RUN fetch -qo /tmp/authelia.tar.gz "${DOWNLOAD_URL}" && -# mkdir -p /usr/local/share/authelia && -# tar -xzf /tmp/authelia.tar.gz -C /usr/local/share/authelia --strip-components=1 && -# rm /tmp/authelia.tar.gz && -# echo "${APP_VERSION}" > /app/version - # Copy root filesystem COPY root/ / # Set permissions RUN chmod +x /etc/services.d/authelia/run /healthz -# Expose +# --- Expose (Injected by Generator) --- EXPOSE 9091 -# Volumes -VOLUME /config \ No newline at end of file +# --- Volumes (Injected by Generator) --- +VOLUME /config /data \ No newline at end of file diff --git a/Containerfile.pkg.j2 b/Containerfile.pkg.j2 index 983b183..079c835 100644 --- a/Containerfile.pkg.j2 +++ b/Containerfile.pkg.j2 @@ -3,7 +3,6 @@ FROM ghcr.io/daemonless/base:${BASE_VERSION} ARG FREEBSD_ARCH=amd64 ARG PACKAGES="authelia" -ARG APP_VERSION="latest" LABEL org.opencontainers.image.title="Authelia" \ org.opencontainers.image.description="Authelia on FreeBSD." \ @@ -24,23 +23,21 @@ LABEL org.opencontainers.image.title="Authelia" \ RUN pkg update && \ pkg install -y ${PACKAGES} && \ pkg clean -ay && \ + mkdir -p /app && pkg info authelia | sed -n 's/.*Version.*: *//p' > /app/version && \ rm -rf /var/cache/pkg/* /var/db/pkg/repos/* -# Download and install authelia -#RUN fetch -qo /tmp/authelia.tar.gz "${DOWNLOAD_URL}" && -# mkdir -p /usr/local/share/authelia && -# tar -xzf /tmp/authelia.tar.gz -C /usr/local/share/authelia --strip-components=1 && -# rm /tmp/authelia.tar.gz && -# echo "${APP_VERSION}" > /app/version - # Copy root filesystem COPY root/ / # Set permissions RUN chmod +x /etc/services.d/authelia/run /healthz -# Expose -EXPOSE 9091 +# --- Expose (Injected by Generator) --- +{%- if ports %} +EXPOSE {{ ports | map(attribute='port') | join(' ') }} +{%- endif %} -# Volumes -VOLUME /config +# --- Volumes (Injected by Generator) --- +{%- if volumes %} +VOLUME {{ volumes | map(attribute='path') | join(' ') }} +{%- endif %} diff --git a/compose.yaml b/compose.yaml index ada5dd7..a59ac46 100644 --- a/compose.yaml +++ b/compose.yaml @@ -36,7 +36,7 @@ services: - TZ=UTC volumes: - - /path/to/containers/authelia:/config + - /path/to/containers/authelia/config:/config - /path/to/containers/authelia/data:/data ports: