File tree Expand file tree Collapse file tree 1 file changed +28
-18
lines changed Expand file tree Collapse file tree 1 file changed +28
-18
lines changed Original file line number Diff line number Diff line change 1
- FROM flyingjoe/uvicorn-gunicorn-fastapi:python3.9-slim
2
-
3
- WORKDIR /app
4
-
5
- ENV PATH="${PATH}:/root/.local/bin"
6
-
7
- ADD . /app/
8
-
9
- EXPOSE 20000
10
-
11
- RUN sed -i "s@http://deb.debian.org@http://mirrors.aliyun.com@g" /etc/apt/sources.list && rm -Rf /var/lib/apt/lists/* && apt-get update
12
-
13
- RUN apt install curl -y
14
-
15
- RUN curl -sSL https://install.python-poetry.org | python3 -
16
-
17
- RUN /usr/local/bin/python -m pip install --no-cache-dir --upgrade --quiet pip
18
-
1
+ FROM sunpeek/poetry:py3.10-slim as base
2
+ # python
3
+ ENV PYTHONUNBUFFERED=1 \
4
+ # prevents python creating .pyc files
5
+ PYTHONDONTWRITEBYTECODE=1 \
6
+ \
7
+ POETRY_VERSION=1.1.4 \
8
+ # make poetry install to this location
9
+ POETRY_HOME="/opt/poetry" \
10
+ POETRY_VIRTUALENVS_IN_PROJECT=true \
11
+ POETRY_NO_INTERACTION=1 \
12
+ \
13
+ # paths
14
+ # this is where our requirements + virtual environment will live
15
+ PYSETUP_PATH="/opt/pysetup" \
16
+ VENV_PATH="/opt/pysetup/.venv"
17
+
18
+ # prepend poetry and venv to path
19
+ ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH"
20
+
21
+ FROM base as base-builder
22
+ WORKDIR $PYSETUP_PATH
23
+ ADD ./poetry.lock ./pyproject.toml ./
19
24
RUN poetry install
20
25
26
+ FROM base as pre-production
27
+ EXPOSE 20000
28
+ COPY --from=base-builder $VENV_PATH /app/.venv/
29
+ COPY . /app/
21
30
VOLUME /app/accounts /app/data
31
+ WORKDIR /app
22
32
23
33
CMD poetry run python3 main.py
You can’t perform that action at this time.
0 commit comments