truthlens-api / Dockerfile
muneeb-1's picture
Upload Dockerfile
1aab264 verified
# Use Python 3.9
FROM python:3.9
# Set working directory to /code
WORKDIR /code
# Copy the requirements file
COPY ./requirements.txt /code/requirements.txt
# Install system dependencies (needed for OpenCV/EasyOCR and building packages)
RUN apt-get update && apt-get install -y \
build-essential \
python3-dev \
libgl1 \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Install dependencies
# We use the CPU-only version of PyTorch to reduce image size
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r /code/requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu
# Copy the application code
COPY ./main.py /code/main.py
# Create a directory for cache (needed for Transformers/Hugging Face models)
# and give it correct permissions
RUN mkdir -p /code/.cache && chmod -R 777 /code/.cache
ENV TRANSFORMERS_CACHE=/code/.cache
# Expose port 7860 (Hugging Face default)
EXPOSE 7860
# Command to run the application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]