fastapi_test / Dockerfile
oneyou's picture
Update Dockerfile
0b4f5aa verified
FROM python:3.10.9
# Install system dependencies
RUN apt-get update && \
apt-get install -y \
tesseract-ocr \
libtesseract-dev \
poppler-utils \
libgl1-mesa-glx && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Set MPLCONFIGDIR to avoid Matplotlib caching issues
ENV MPLCONFIGDIR /tmp/matplotlib-cache
# Set TRANSFORMERS_CACHE to a writable directory
ENV TRANSFORMERS_CACHE /tmp/huggingface-cache
# Create a directory for your application
RUN mkdir /app
WORKDIR /app
# Copy your app.py into the container
COPY app.py .
# Install Python dependencies with specific versions
RUN pip install --no-cache-dir \
chromadb==0.5.3 \
langchain==0.2.7 \
langchain-community==0.2.7 \
langchain-core==0.2.12 \
langchain-text-splitters==0.2.2 \
lxml==4.9.4 \
openai==1.35.10 \
opencv-python==4.8.0.76 \
opencv-python-headless==4.10.0.84 \
pydantic==2.8.0 \
pydantic-core==2.20.0 \
pytesseract==0.3.10 \
tiktoken==0.7.0 \
unstructured==0.14.9 \
unstructured-client==0.24.0 \
unstructured-inference==0.7.36 \
unstructured.pytesseract==0.3.12 \
ipython \
psutil \
pillow-heif
# # Clone the project from GitHub
# RUN git clone https://github.com/amansoni7477030/fastAPI_production.git /app
# WORKDIR /app
# # Install Python dependencies
# RUN pip install --no-cache-dir --upgrade -r requirements.txt
# # Expose the port on which FastAPI will run
# EXPOSE 7860
# Command to run the app.py script
CMD ["python", "app.py"]
# Command to run the FastAPI server
# CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]