LEXGUARD_API / Dockerfile
Phoenix1410's picture
Update Dockerfile
d819566 verified
Raw History Blame Contribute Delete
822 Bytes
# 1. Use Python 3.9 Slim
FROM python:3.9-slim
# 2. Install essential system dependencies and SSL certificates as root
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
&& update-ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# 3. Create a non-root user (Hugging Face requirement: UID 1000)
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
# 4. Set work directory
WORKDIR /app
# 5. Install Python Dependencies
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# 6. Copy the Application Code
COPY --chown=user . .
# 7. Run the Application on Hugging Face default port 7860
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]