-
Notifications
You must be signed in to change notification settings - Fork 7
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
david zhou
authored and
david zhou
committed
Jun 17, 2024
1 parent
c004c17
commit 7b7ed7f
Showing
1 changed file
with
25 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,25 @@ | ||
# ===== Stage 1: Base Image with Python Installed ===== | ||
FROM python:3.11-slim as base | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
WORKDIR /app | ||
|
||
# Install dependencies | ||
COPY requirements.txt . | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
# ===== Stage 2: Application Layer ===== | ||
FROM base as final | ||
|
||
# Copy application code | ||
COPY . . | ||
|
||
# Set a non-root user and switch to it | ||
RUN useradd -m myuser | ||
USER myuser | ||
|
||
# Set the port the app runs on | ||
EXPOSE 8000 | ||
|
||
# Command to run your app | ||
CMD ["python3", "-u", "src/server.py"] |