Files
Kaname/Dockerfile
T
Pascal LinxweilerandClaude Opus 5.5 30b01d7bca Add Gitea release pipeline and server compose
- .gitea/workflows/release.yaml: on vX.Y.Z tags run checks, build and push the
  image to the Gitea registry (X.Y.Z, X.Y, latest), create a release from the
  CHANGELOG section
- scripts/release-notes.mjs: extract changelog section, create the release
- deploy/compose.yaml: server setup using the released image
- APP_VERSION build arg, shown in the header

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 17:12:32 +02:00

53 lines
1.7 KiB
Docker

# One image for both services: `web` (next start) and `worker` (node dist/worker.mjs).
FROM node:24-trixie-slim AS node
# --- build -------------------------------------------------------------------
FROM node AS build
ENV NEXT_TELEMETRY_DISABLED=1
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
RUN npm run build \
&& npm run build:worker \
&& npm prune --omit=dev
# --- runtime -----------------------------------------------------------------
# Python base (provides the official `hf` CLI) plus the Node binary. The Python image already
# has CA certificates and libstdc++, so no apt is needed.
FROM python:3.13-slim-trixie AS runtime
COPY --from=node /usr/local/bin/node /usr/local/bin/node
# Pinned: the worker relies on the CLI's on-disk layout (see src/worker/hf-layout.ts);
# re-verify that before bumping.
ARG HF_HUB_VERSION=2.1.1
RUN python -m venv /opt/hf \
&& /opt/hf/bin/pip install --no-cache-dir "huggingface_hub[hf_xet]==${HF_HUB_VERSION}" \
&& rm -rf /root/.cache \
&& useradd --uid 1000 --create-home --shell /usr/sbin/nologin app \
&& mkdir -p /data /models \
&& chown app:app /data /models
ARG APP_VERSION=dev
ENV PATH=/opt/hf/bin:$PATH \
APP_VERSION=$APP_VERSION \
NODE_ENV=production \
NEXT_TELEMETRY_DISABLED=1 \
PORT=3000 \
HOSTNAME=0.0.0.0 \
DATABASE_URL=file:/data/app.db \
MODELS_DIR=/models \
HF_HOME=/data/hf-home
WORKDIR /app
COPY --from=build --chown=app:app /app/package.json /app/next.config.ts ./
COPY --from=build --chown=app:app /app/node_modules ./node_modules
COPY --from=build --chown=app:app /app/.next ./.next
COPY --from=build --chown=app:app /app/dist ./dist
COPY --from=build --chown=app:app /app/drizzle ./drizzle
USER app
EXPOSE 3000
CMD ["node_modules/.bin/next", "start"]