testFastAPI / Dockerfile
YasirAhmad0810's picture
Update Dockerfile
93ed878 verified
FROM python:3.13.5-slim
# Set the working directory inside the container
WORKDIR /app
# Install necessary dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
# Copy the requirements file to the working directory
COPY requirements.txt ./
# Copy the FastAPI application files
COPY src/ ./src/
# Install Python dependencies from requirements.txt
RUN pip3 install -r requirements.txt
# Expose the port that the FastAPI app will run on
EXPOSE 7860
# Health check for FastAPI (adjust if needed)
HEALTHCHECK CMD curl --fail http://localhost:7860/health || exit 1
# Set the entry point to run the FastAPI app with uvicorn
ENTRYPOINT ["uvicorn", "src.app:app", "--host", "0.0.0.0", "--port", "7860"]