foresight / Dockerfile
umangchaudhry's picture
Deploy dcb389d from GitHub
6b7e4ba verified
Raw
History Blame Contribute Delete
967 Bytes
# Foresight app image — serves the frontend, the knowledge base, and the
# per-student API. Targets Hugging Face Spaces (sdk: docker), but it's a plain
# container and runs anywhere.
FROM python:3.12-slim
# Spaces run the container as uid 1000; matching it here keeps file ownership
# sane and avoids running as root.
RUN useradd --create-home --uid 1000 foresight
WORKDIR /home/foresight/app
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=1 \
HF_HOME=/home/foresight/.cache/huggingface
# Dependencies first so code edits don't invalidate the layer.
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY server/ ./server/
COPY app/ ./app/
COPY knowledge-base/ ./knowledge-base/
RUN chown -R foresight:foresight /home/foresight
USER foresight
# 7860 is the port Spaces expects (see app_port in the Space README).
EXPOSE 7860
CMD ["uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "7860"]