test24 / Dockerfile
Niansuh's picture
Update Dockerfile
5797023 verified
raw
history blame
1.01 kB
# Use the official Python 3.9 slim image as the base
FROM python:3.9-slim
# Set environment variables to prevent Python from buffering stdout and stderr
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
# Set the working directory inside the container
WORKDIR /app
# Install system dependencies (if any)
# Uncomment the following lines if your application requires additional system packages
# RUN apt-get update && apt-get install -y \
# build-essential \
# libssl-dev \
# libffi-dev \
# && rm -rf /var/lib/apt/lists/*
# Copy the requirements file into the container
COPY requirements.txt .
# Upgrade pip to the latest version
RUN pip install --upgrade pip
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application code into the container
COPY . .
# Expose port 8000 to the host
EXPOSE 8000
# Define the default command to run the application using Uvicorn
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]