-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ab836d9
commit 24083e4
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Stage 1: Build | ||
FROM python:3.11 AS builder | ||
|
||
WORKDIR /app | ||
|
||
# Copy only dependency files first for better caching | ||
COPY requirements.txt /app/ | ||
RUN pip install --no-cache-dir --upgrade pip && pip install --no-cache-dir -r requirements.txt | ||
|
||
# Stage 2: Final image | ||
FROM python:3.11-slim | ||
|
||
WORKDIR /app | ||
|
||
# Copy installed dependencies from builder stage | ||
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages | ||
COPY --from=builder /usr/local/bin /usr/local/bin | ||
|
||
# Copy application files | ||
COPY ./app /app | ||
|
||
# Set environment variables | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
# Expose API port | ||
EXPOSE 8000 | ||
|
||
# Default command | ||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"] |