generated from pythoninthegrasses/python_template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.og
More file actions
43 lines (33 loc) · 1.11 KB
/
Dockerfile.og
File metadata and controls
43 lines (33 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
FROM python:3.11-slim-bullseye
# avoid stuck build due to user prompt
ARG DEBIAN_FRONTEND=noninteractive
# install dependencies
RUN apt -qq update && apt -qq install -y curl gcc lsof python3-dev
RUN rm -rf /var/lib/apt/lists/*
# pip env vars
ENV PIP_DISABLE_PIP_VERSION_CHECK=on
ENV PIP_DEFAULT_TIMEOUT=100
# poetry env vars
ENV POETRY_HOME="/opt/poetry"
ENV POETRY_VERSION=1.4.2
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
ENV POETRY_NO_INTERACTION=1
# path
ENV VENV="/opt/venv"
ENV PATH="$POETRY_HOME/bin:$VENV/bin:$PATH"
# working directory (creates dir if it doesn't exist)
RUN mkdir -p /app
WORKDIR /app
# copy all files from current dir to working dir
COPY . .
# install poetry and dependencies
RUN python -m venv $VENV && . "${VENV}/bin/activate"
RUN python -m pip install "poetry==${POETRY_VERSION}"
RUN poetry install --no-ansi --no-root --without dev
# listening port (not published)
EXPOSE 3000
# ENTRYPOINT ["python", "main.py"]
# ENTRYPOINT ["poetry", "shell"]
CMD ["/bin/bash"]
# TODO: `TypeError: FastAPI.__call__() missing 1 required positional argument: 'send'`
# CMD ["gunicorn", "-c", "gunicorn.conf.py", "main:app"]