-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
consolidate python dockerfiles (#3717)
- Loading branch information
1 parent
92b9ea9
commit b57e7fb
Showing
8 changed files
with
70 additions
and
90 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
File renamed without changes.
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,49 @@ | ||
FROM python:{{ .pyVersion }} AS builder | ||
|
||
ENV PYTHONUNBUFFERED=1 \ | ||
PYTHONDONTWRITEBYTECODE=1 | ||
|
||
WORKDIR /app | ||
COPY . . | ||
|
||
{{ if .pipenv -}} | ||
|
||
ENV PIPENV_VENV_IN_PROJECT=1 \ | ||
PIPENV_CUSTOM_VENV_NAME=.venv | ||
RUN pip install pipenv | ||
RUN pipenv install | ||
|
||
{{ else if .poetry -}} | ||
|
||
RUN pip install poetry | ||
RUN poetry config virtualenvs.in-project true | ||
RUN poetry install | ||
|
||
{{ else if .pep621 -}} | ||
|
||
RUN python -m venv .venv && \ | ||
. .venv/bin/activate && \ | ||
pip install --upgrade pip && \ | ||
pip install . | ||
|
||
{{ else if .pip }} | ||
|
||
RUN python -m venv .venv && \ | ||
. .venv/bin/activate && \ | ||
pip install --upgrade pip && \ | ||
pip install -r requirements.txt | ||
|
||
{{ end -}} | ||
|
||
FROM python:{{ .pyVersion }}-slim | ||
|
||
WORKDIR /app | ||
COPY --from=builder /app . | ||
|
||
{{ if .flask -}} | ||
CMD ["/app/.venv/bin/flask", "run", "--host=0.0.0.0", "--port=8080"] | ||
{{ else if .fastapi -}} | ||
CMD ["/app/.venv/bin/fastapi", "run"] | ||
{{ else if .streamlit -}} | ||
CMD ["/app/.venv/bin/streamlit", "run", "{{ .entrypoint }}"] | ||
{{ end -}} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.