diff --git a/.daemonless/compose.yaml b/.daemonless/compose.yaml new file mode 100644 index 0000000..faa1d49 --- /dev/null +++ b/.daemonless/compose.yaml @@ -0,0 +1,34 @@ +name: authelia-test + +services: + authelia-server: + image: ghcr.io/daemonless/authelia-server:build + network_mode: host + restart: unless-stopped + + environment: + PUID: 1000 + PGID: 1000 + TZ: UTC + CIT_RUN: true + + volumes: + - config:/config + + ports: + - 9099:9099 + + depends_on: + - redis + + redis: + image: ghcr.io/daemonless/redis:latest + network_mode: host + restart: unless-stopped + volumes: + - /etc/localtime:/etc/localtime:ro + - redis:/config + +volumes: + config: + redis: diff --git a/.daemonless/config.yaml b/.daemonless/config.yaml index 4bc44b0..b0aec4d 100644 --- a/.daemonless/config.yaml +++ b/.daemonless/config.yaml @@ -1,6 +1,9 @@ icon: ':simple-authelia:' cit: - mode: shell + compose: true + mode: health + port: 9099 + health: /api/health build: pkg_name: authelia auto_version: true diff --git a/Containerfile b/Containerfile index 1c240b3..c820d08 100644 --- a/Containerfile +++ b/Containerfile @@ -11,7 +11,7 @@ ARG FREEBSD_ARCH=amd64 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" +ARG HEALTHCHECK_ENDPOINT="http://localhost:9091/api/health" LABEL org.opencontainers.image.title="Authelia" \ org.opencontainers.image.description="Authelia on FreeBSD." \ @@ -27,15 +27,7 @@ LABEL org.opencontainers.image.title="Authelia" \ io.daemonless.upstream-repo=authelia/authelia \ io.daemonless.upstream-url="${UPSTREAM_URL}" \ io.daemonless.upstream-jq="${UPSTREAM_JQ}" \ - io.daemonless.healthcheck-url="${HEALTHCHECK_ENDPOINT}" \ - io.daemonless.wip="true" - - -# Install dependencies -#RUN pkg update && \ -# pkg install -y ${PACKAGES} && \ -# pkg clean -ay && \ -# rm -rf /var/cache/pkg/* /var/db/pkg/repos/* + io.daemonless.healthcheck-url="${HEALTHCHECK_ENDPOINT}" # Download and install authelia RUN APP_VERSION=$(fetch -qo - "${UPSTREAM_URL}" | \ @@ -58,4 +50,4 @@ RUN chmod +x /etc/services.d/*/run /etc/cont-init.d/* /healthz 2>/dev/null || tr EXPOSE 9091 # --- Volumes (Injected by Generator) --- -VOLUME /config /data \ No newline at end of file +VOLUME /config \ No newline at end of file diff --git a/Containerfile.j2 b/Containerfile.j2 index e706e04..bc12673 100644 --- a/Containerfile.j2 +++ b/Containerfile.j2 @@ -5,7 +5,7 @@ ARG FREEBSD_ARCH=amd64 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" +ARG HEALTHCHECK_ENDPOINT="http://localhost:9091/api/health" LABEL org.opencontainers.image.title="{{ title }}" \ org.opencontainers.image.description="{{ description }}" \ @@ -23,15 +23,7 @@ LABEL org.opencontainers.image.title="{{ title }}" \ io.daemonless.upstream-repo=authelia/authelia \ io.daemonless.upstream-url="${UPSTREAM_URL}" \ io.daemonless.upstream-jq="${UPSTREAM_JQ}" \ - io.daemonless.healthcheck-url="${HEALTHCHECK_ENDPOINT}" \ - io.daemonless.wip="true" - - -# Install dependencies -#RUN pkg update && \ -# pkg install -y ${PACKAGES} && \ -# pkg clean -ay && \ -# rm -rf /var/cache/pkg/* /var/db/pkg/repos/* + io.daemonless.healthcheck-url="${HEALTHCHECK_ENDPOINT}" # Download and install authelia RUN APP_VERSION=$(fetch -qo - "${UPSTREAM_URL}" | \ diff --git a/Containerfile.pkg b/Containerfile.pkg index 57cc1cf..022bc5e 100644 --- a/Containerfile.pkg +++ b/Containerfile.pkg @@ -21,25 +21,15 @@ LABEL org.opencontainers.image.title="Authelia" \ io.daemonless.category="Utilities" \ io.daemonless.port="9091" \ io.daemonless.arch="${FREEBSD_ARCH}" \ - io.daemonless.packages="${PACKAGES}" \ - io.daemonless.wip="true" - + io.daemonless.packages="${PACKAGES}" # Install from FreeBSD packages -RUN pkg update && pkg install -y ${PACKAGES} && \ - pkg clean -ay && rm -rf /var/cache/pkg/* /var/db/pkg/repos/* - -# Install dependencies RUN pkg update && \ pkg install -y ${PACKAGES} && \ - pkg clean -ay && \ mkdir -p /app && pkg info authelia | sed -n 's/.*Version.*: *//p' > /app/version && \ + pkg clean -ay && \ rm -rf /var/cache/pkg/* /var/db/pkg/repos/* -# Extract version -RUN mkdir -p /app && \ - pkg info authelia | sed -n 's/.*Version.*: *//p' > /app/version - # Copy root filesystem and set permissions COPY root/ / RUN if [ -f /etc/services.d/authelia/run.pkg ]; then \ @@ -52,4 +42,4 @@ RUN if [ -f /etc/services.d/authelia/run.pkg ]; then \ EXPOSE 9091 # --- Volumes (Injected by Generator) --- -VOLUME /config /data \ No newline at end of file +VOLUME /config \ No newline at end of file diff --git a/Containerfile.pkg.j2 b/Containerfile.pkg.j2 index 540f6e9..97817e7 100644 --- a/Containerfile.pkg.j2 +++ b/Containerfile.pkg.j2 @@ -15,25 +15,15 @@ LABEL org.opencontainers.image.title="Authelia" \ io.daemonless.category="Utilities" \ io.daemonless.port="9091" \ io.daemonless.arch="${FREEBSD_ARCH}" \ - io.daemonless.packages="${PACKAGES}" \ - io.daemonless.wip="true" - + io.daemonless.packages="${PACKAGES}" # Install from FreeBSD packages -RUN pkg update && pkg install -y ${PACKAGES} && \ - pkg clean -ay && rm -rf /var/cache/pkg/* /var/db/pkg/repos/* - -# Install dependencies RUN pkg update && \ pkg install -y ${PACKAGES} && \ - pkg clean -ay && \ mkdir -p /app && pkg info authelia | sed -n 's/.*Version.*: *//p' > /app/version && \ + pkg clean -ay && \ rm -rf /var/cache/pkg/* /var/db/pkg/repos/* -# Extract version -RUN mkdir -p /app && \ - pkg info authelia | sed -n 's/.*Version.*: *//p' > /app/version - # Copy root filesystem and set permissions COPY root/ / RUN if [ -f /etc/services.d/authelia/run.pkg ]; then \ diff --git a/README.md b/README.md index d9372bb..fd18b7f 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,6 @@ services: - TZ=UTC volumes: - "/path/to/containers/authelia-server:/config" - - "/path/to/containers/authelia-server/data:/data" ports: - 9091:9091 restart: unless-stopped @@ -63,7 +62,6 @@ podman run -d --name authelia-server \ -e PGID=1000 \ -e TZ=UTC \ -v /path/to/containers/authelia-server:/config \ - -v /path/to/containers/authelia-server/data:/data \ ghcr.io/daemonless/authelia-server:latest ``` @@ -84,7 +82,6 @@ podman run -d --name authelia-server \ - "9091:9091" volumes: - "/path/to/containers/authelia-server:/config" - - "/path/to/containers/authelia-server/data:/data" ``` @@ -103,7 +100,6 @@ podman run -d --name authelia-server \ | Path | Description | |------|-------------| | `/config` | Configuration directory | -| `/data` | data directory | ### Ports @@ -111,8 +107,6 @@ podman run -d --name authelia-server \ |------|----------|-------------| | `9091` | TCP | Web UI | -This image is part of the [Authelia Stack](https://daemonless.io/images/authelia). - **Architectures:** amd64 **User:** `bsd` (UID/GID via PUID/PGID, defaults to 1000:1000) **Base:** FreeBSD 15.0 diff --git a/compose.yaml b/compose.yaml index a59ac46..3a3a214 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,4 +1,4 @@ -name: authelia-server +name: authelia x-daemonless: title: "Authelia" @@ -11,7 +11,6 @@ x-daemonless: user: "bsd" mlock: false community: "Discord:https://discord.gg/Kb9tkhecZT" - notes: "This image is part of the [Authelia Stack](https://daemonless.io/images/authelia)." docs: env: @@ -20,7 +19,6 @@ x-daemonless: TZ: "Timezone for the container" volumes: /config: "Configuration directory" - /data: "data directory" ports: 9091: "Web UI" @@ -29,15 +27,24 @@ services: image: ghcr.io/daemonless/authelia-server:latest container_name: authelia-server restart: unless-stopped - environment: - PUID=1000 - PGID=1000 - TZ=UTC - volumes: - /path/to/containers/authelia/config:/config - - /path/to/containers/authelia/data:/data - ports: - 9091:9091 + depends_on: + - redis + + redis: + container_name: authelia_redis + image: ghcr.io/daemonless/redis:latest + restart: unless-stopped + volumes: + - /etc/localtime:/etc/localtime:ro + - redis:/config + +volumes: + redis: diff --git a/root/etc/cont-init.d/30-test-init b/root/etc/cont-init.d/30-test-init new file mode 100755 index 0000000..9bc2d0e --- /dev/null +++ b/root/etc/cont-init.d/30-test-init @@ -0,0 +1,42 @@ +#!/bin/sh +echo "Initializing config for test" +if [ "x${CIT_RUN}" == "x" ]; then + # If we are not running as a cit test, exit and do not overwrite the config + exit 0 +fi + +echo "Writing config for test" +# Write a minimal config for testing app startup +cat << EOF > /config/authelia.yml +--- +server: + address: 'tcp://:9099/' +identity_validation: + reset_password: + jwt_secret: 'a_very_important_secret' +authentication_backend: + file: + path: '/config/users_database.yml' +access_control: + default_policy: 'one_factor' +session: + secret: 'insecure_session_secret' + cookies: + - + name: 'authelia_session' + domain: 'example.com' + authelia_url: 'https://auth.example.com' + redis: + host: '127.0.0.1' + port: 6379 +storage: + encryption_key: 'you_must_generate_a_random_string_of_more_than_twenty_chars_and_configure_this' + local: + path: '/config/db.sqlite3' +notifier: + filesystem: + filename: '/config/notification.txt' +... +EOF + +chown bsd:bsd /config/authelia.yml