document-ocr / Dockerfile
fm1320's picture
Initial: document-ocr demo for HF Spaces
ffe59ba
Raw
History Blame
1.67 kB
# Hugging Face Spaces image. Extends the official SIE server image, adds
# Node 22 for the UI server, and runs both processes from one container.
#
# This Dockerfile is HF Spaces specific. Local Docker users should use
# compose.yml (which just runs the unmodified upstream SIE image with the
# Node UI on the host).
FROM ghcr.io/superlinked/sie-server:latest-cpu-default
USER root
# Node 22 for the UI server (tsx + node:http + our Express-free server.ts)
# The SIE base image is minimal; install curl + ca-certificates before
# pulling NodeSource's setup script.
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl ca-certificates gnupg \
&& curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
&& apt-get install -y --no-install-recommends nodejs \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# HF Spaces' persistent storage lives at /data (50 GB free tier).
# Send the HuggingFace cache there so model weights survive Space restarts.
ENV HF_HOME=/data/.cache/huggingface
# UI server lives under /app/ui (the SIE base image already owns /app/...)
WORKDIR /app/ui
COPY package.json tsconfig.json ./
RUN npm install --silent
COPY src ./src
COPY web ./web
COPY data ./data
# Entrypoint script orchestrates both processes (SIE in background, UI in foreground).
COPY hf-entrypoint.sh /usr/local/bin/hf-entrypoint.sh
RUN chmod +x /usr/local/bin/hf-entrypoint.sh
# Make /app/ui world-readable so any HF Space user account can access it.
# Also make /data writable so the HF cache can be written there.
RUN chmod -R a+rx /app/ui && mkdir -p /data && chmod -R a+rwx /data
EXPOSE 7860
ENTRYPOINT ["/usr/local/bin/hf-entrypoint.sh"]