authelia-api/Dockerfile
root 0d86609798 Add Docker container combining Authelia + Authelia-API
- Multi-stage Dockerfile (Authelia v4.39.20 + authelia-api binary)
- Entrypoint script with bootstrap, health monitoring, graceful shutdown
- docker-compose.yml for volume-based deployment
- Example config and user DB placeholder
- README updated with Docker deployment docs
2026-06-24 18:54:27 +00:00

58 lines
1.7 KiB
Docker

# syntax=docker/dockerfile:1
#
# Authelia + Authelia-API combined container
# ===========================================
# Runs both Authelia (auth portal, port 9091) and Authelia-API
# (user management API, port 8080) in a single container.
#
# Volumes:
# /config — Authelia config + user DB + notification templates
# /data — Authelia-API SQLite DB
# /certs — TLS certificates (optional)
#
# --- Stage 1: fetch Authelia binary ---
FROM alpine:3.21 AS authelia-dl
ARG AUTHELIA_VERSION=4.39.20
ARG TARGETARCH=amd64
ARG TARGETPLATFORM=linux/amd64
WORKDIR /tmp
ADD https://github.com/authelia/authelia/releases/download/v${AUTHELIA_VERSION}/authelia-v${AUTHELIA_VERSION}-linux-${TARGETARCH}.tar.gz /tmp/authelia.tar.gz
RUN tar -xzf /tmp/authelia.tar.gz && \
mv authelia /usr/local/bin/authelia && \
chmod +x /usr/local/bin/authelia
# --- Stage 2: runtime image (glibc-based for Authelia binary) ---
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
tzdata \
libsqlite3-0 \
netcat-openbsd \
&& rm -rf /var/lib/apt/lists/*
# Copy binaries
COPY --from=authelia-dl /usr/local/bin/authelia /usr/local/bin/authelia
COPY authelia-api /usr/local/bin/authelia-api
# Create directories
RUN mkdir -p /config /data /certs && \
chmod 755 /config /data /certs
# Add non-root user
RUN groupadd -r authelia && \
useradd -r -g authelia -d /config -s /sbin/nologin authelia && \
chown authelia:authelia /config /data /certs
# Entrypoint
COPY docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
EXPOSE 9091 8080
VOLUME ["/config", "/data", "/certs"]
ENTRYPOINT ["/entrypoint.sh"]