Update Dockerfile
Browse files1234567891011121314151617181920212223242526272829# Use the official Python 3.10 slim imageFROM python:3.10-slim# Set environment variables to prevent Python from writing pyc files and to buffer stdout/stderrENV PYTHONDONTWRITEBYTECODE=1ENV PYTHONUNBUFFERED=1# Set the working directory to /appWORKDIR /app# Install system dependencies (if any)# For example, if you need gcc for some packages, uncomment the following line# RUN apt-get update && apt-get install -y gcc# Copy only the requirements.txt first to leverage Docker cacheCOPY requirements.txt .# Install Python dependenciesRUN pip install --no-cache-dir --upgrade pipRUN pip install --no-cache-dir -r requirements.txt# Copy the rest of the application codeCOPY . .# Expose port 8001 to the outside worldEXPOSE 8001# Command to run the FastAPI app with UvicornCMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8001"]1234567891011121314151617181920# DockerfileFROM python:3.11-slim# Set the working directory in the containerWORKDIR /app# Copy the requirements file into the containerCOPY requirements.txt .# Install the dependenciesRUN pip install --no-cache-dir -r requirements.txt# Copy the application code into the containerCOPY . .# Expose the port that the app runs onEXPOSE 8000# Command to run the applicationCMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
Dockerfile+10-19