30 lines
873 B
Docker
30 lines
873 B
Docker
# Use an official Python runtime as a parent image
|
|
FROM python:3.11-slim
|
|
|
|
# Set the working directory in the container
|
|
WORKDIR /app
|
|
|
|
# Install system dependencies
|
|
# build-essential contains gcc and other tools often needed for python packages
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
build-essential \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy the requirements file into the container at /app
|
|
COPY requirements.txt .
|
|
|
|
# Install any needed packages specified in requirements.txt
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy the current directory contents into the container at /app
|
|
COPY . .
|
|
|
|
# Make port available to the world outside this container
|
|
EXPOSE 9600
|
|
|
|
# Define environment variable
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
# Run app.py when the container launches
|
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "9600"]
|