generated from PrivateAIM/python-template
-
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.
Merge pull request #7 from PrivateAIM/6-add-dockerfile
Add Dockerfile
- Loading branch information
Showing
1 changed file
with
23 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,23 @@ | ||
FROM python:3.11-alpine AS builder | ||
|
||
WORKDIR /tmp | ||
COPY ./pyproject.toml ./poetry.lock ./ | ||
|
||
RUN pip install poetry==1.7.1 && \ | ||
poetry export -n --without dev -f requirements.txt -o requirements.txt | ||
|
||
FROM python:3.11-alpine | ||
|
||
WORKDIR /app | ||
|
||
COPY ./config/ ./config/ | ||
COPY --from=builder /tmp/requirements.txt ./ | ||
COPY ./project/ ./project/ | ||
|
||
RUN pip install -r requirements.txt | ||
|
||
# PYTHONPATH hack is needed here because /app contains the "project" | ||
# module which is referenced in parts of the source code. | ||
ENV PYTHONPATH=/app | ||
|
||
CMD ["python", "project/main.py", "server", "--no-reload", "-p", "8080"] |