clarifapi / Dockerfile
Prat0's picture
Update Dockerfile
dfd2dd2 verified
raw
history blame
763 Bytes
# Use the official Python image as a base
FROM python:3.9-slim
# Install necessary system dependencies
RUN apt-get update && apt-get install -y \
gcc \
build-essential \
libffi-dev \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Set environment variables
ENV PYTHONUNBUFFERED=1
# Create and set the working directory
WORKDIR /app
# Copy the requirements file first to leverage Docker cache
COPY requirements.txt ./
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Copy the application code to the container
COPY . .
# Expose the port that FastAPI will run on
EXPOSE 7860
# Command to run the FastAPI application with Uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]