Recruitment_Copilot / Dockerfile
Ashgen12's picture
Switch base image to python:3.12-slim
74e26fb verified
Raw
History Blame Contribute Delete
1.13 kB
# Hugging Face Space (Docker SDK) — backend only.
# The frontend runs separately on Netlify (or Vercel). Netlify only needs
# BACKEND_URL pointing at this Space's public URL.
FROM python:3.12-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
HF_HOME=/home/user/.cache/huggingface
# HF Spaces runs containers as UID 1000. Create that user up-front so writes to
# uploads/data/logs work without root.
RUN useradd --create-home --uid 1000 user
WORKDIR /home/user/app
COPY --chown=user:user backend/requirements.txt requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
COPY --chown=user:user backend ./backend
# Pre-create the writable directories the app expects. On the free Space tier
# these are ephemeral (wiped on rebuild/sleep) — point S3_* at Supabase Storage
# in your Space secrets to persist resume PDFs across restarts.
RUN mkdir -p backend/data/uploads backend/data/reference_resumes logs && \
chown -R user:user backend/data logs
USER user
WORKDIR /home/user/app/backend
EXPOSE 7860
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]