26 lines
830 B
Docker
26 lines
830 B
Docker
# D:\GNPL-Private\TimeCraft\backend\Dockerfile
|
|
|
|
# Use a slim, official Python image to reduce overall image size
|
|
FROM python:3.10-slim-buster
|
|
|
|
# Set the working directory inside the container
|
|
WORKDIR /app
|
|
|
|
# Copy the requirements file into the container
|
|
COPY requirements.txt .
|
|
|
|
# Install dependencies without caching to keep the image lightweight
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy the application source code into the container
|
|
COPY ./app /app/app
|
|
COPY main.py /app/main.py
|
|
|
|
# Expose the port Uvicorn will use to serve FastAPI
|
|
EXPOSE 8000
|
|
|
|
# Define the container startup command to run the FastAPI app via Uvicorn
|
|
# - main:app -> refers to 'app' inside main.py
|
|
# - 0.0.0.0 -> binds to all interfaces so it's accessible outside container
|
|
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|