-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Bubbles The Dev <[email protected]>
- Loading branch information
Showing
1 changed file
with
27 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,27 @@ | ||
# Use a slim official Python image for better control over Python version and size | ||
FROM python:3.10-slim | ||
|
||
# Set up environment variables for the virtual environment | ||
ENV VIRTUAL_ENV=/env | ||
RUN python3 -m venv $VIRTUAL_ENV | ||
ENV PATH="$VIRTUAL_ENV/bin:$PATH" | ||
|
||
# Install system dependencies and required libraries | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
libopencv-dev \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy the application's requirements.txt and install Python dependencies | ||
COPY requirements.txt /app/requirements.txt | ||
RUN pip install --upgrade pip && \ | ||
pip install --no-cache-dir -r /app/requirements.txt | ||
|
||
# Copy the application source code | ||
COPY . /app | ||
WORKDIR /app | ||
|
||
# Expose the port used by Gunicorn | ||
EXPOSE $PORT | ||
|
||
# Run Gunicorn to serve the application (ensure gunicorn is in requirements.txt) | ||
CMD ["gunicorn", "-b", ":$PORT", "main:app"] |