-
Notifications
You must be signed in to change notification settings - Fork 53
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
Showing
1 changed file
with
4 additions
and
13 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 |
---|---|---|
@@ -1,29 +1,20 @@ | ||
# Use an official Python runtime as a parent image | ||
FROM python:3.11 AS builder | ||
|
||
# Set the working directory in the container | ||
WORKDIR /usr/src/app | ||
|
||
# Copy the current directory contents into the container at /usr/src/app | ||
COPY . /usr/src/app | ||
# Copy the current directory contents into the container | ||
COPY . . | ||
|
||
# Install Poetry | ||
RUN pip install poetry | ||
|
||
ENV POETRY_NO_INTERACTION=1 \ | ||
POETRY_VIRTUALENVS_IN_PROJECT=1 \ | ||
POETRY_VIRTUALENVS_CREATE=1 \ | ||
POETRY_CACHE_DIR=/tmp/poetry_cache \ | ||
MAX_CONCURRENCY=20 | ||
|
||
# Copy only dependency files for layer caching | ||
COPY pyproject.toml poetry.lock ./ | ||
|
||
# Install the required packages of the application into .venv | ||
# Install the required packages of the application | ||
RUN poetry install --no-root && rm -rf $POETRY_CACHE_DIR | ||
|
||
# Make port 80 available to the world outside this container | ||
ENV PORT="8080" | ||
|
||
# Run app.py when the container launches | ||
# Run main.py when the container launches | ||
CMD exec gunicorn --bind :$PORT --workers 2 --timeout 0 --worker-class uvicorn.workers.UvicornWorker --threads 8 main:app |