Files
Manoj Bajaj 6231674610 feat: add Dockerfile, docker-compose, and self-hosting guide
Enables single-command self-deployment of the authsome daemon in a
container without requiring Python or uv on the host.

- Multi-stage Dockerfile: ui-builder (Node 24/pnpm) → py-builder (uv
  wheel) → slim Python 3.13 runtime, non-root authsome user
- docker-compose.yml with named volume and restart: unless-stopped
- .dockerignore to keep the build context minimal
- docs/guides/self-hosting.md covering quick-start, env vars, volume
  backup/restore, TLS with Caddy, and local builds
- .github/workflows/docker.yml CI job that builds the image on every PR
- README.md self-hosting quick-start section

Closes #366

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 16:45:48 +05:30

38 lines
1006 B
Docker

# Stage 1: Build the Next.js static UI
FROM node:24-slim AS ui-builder
WORKDIR /app
COPY ui/ ./ui/
RUN npm install -g pnpm@10 --silent && \
pnpm --dir ui install --frozen-lockfile && \
pnpm --dir ui build
# Stage 2: Build the Python wheel
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim AS py-builder
WORKDIR /app
COPY . .
# Inject UI assets built in stage 1 before packaging the wheel
COPY --from=ui-builder /app/ui/out ./ui/out
RUN mkdir -p src/authsome/ui/web && \
cp -R ui/out/. src/authsome/ui/web/ && \
uv build --wheel --out-dir /dist
# Stage 3: Minimal runtime image
FROM python:3.13-slim AS runtime
RUN groupadd -r authsome && \
useradd -r -g authsome -d /home/authsome -m -s /sbin/nologin authsome
COPY --from=py-builder /dist /dist
RUN pip install --no-cache-dir /dist/*.whl && rm -rf /dist
ENV AUTHSOME_HOME=/data/authsome
EXPOSE 7998
VOLUME ["/data/authsome"]
USER authsome
ENTRYPOINT ["authsome", "daemon", "serve"]
CMD ["--host", "0.0.0.0", "--port", "7998"]