@@ -8,53 +8,42 @@ ENV PYTHONUNBUFFERED=1 \
88 PIP_DISABLE_PIP_VERSION_CHECK=on \
99 PIP_DEFAULT_TIMEOUT=100 \
1010 \
11- # poetry
12- # https://python-poetry.org/docs/configuration/#using-environment-variables
13- POETRY_VERSION=1.3.2 \
14- # make poetry install to this location
15- POETRY_HOME="/opt/poetry" \
16- # make poetry create the virtual environment in the project's root
17- # it gets named `.venv`
18- POETRY_VIRTUALENVS_IN_PROJECT=true \
19- # do not ask any interactive question
20- POETRY_NO_INTERACTION=1 \
21- \
2211 # paths
2312 # this is where our requirements + virtual environment will live
2413 PYSETUP_PATH="/opt/pysetup" \
2514 VENV_PATH="/opt/pysetup/.venv"
2615
2716
28- # prepend poetry and venv to path
29- ENV PATH="$POETRY_HOME/bin:$ VENV_PATH/bin:$PATH"
17+ # prepend venv to path
18+ ENV PATH="$VENV_PATH/bin:$PATH"
3019
3120FROM python-base as builder-base
3221RUN apt-get update \
3322 && apt-get install --no-install-recommends -y \
34- # deps for installing poetry
23+ # deps for installing uv
3524 curl \
3625 # deps for building python deps
3726 build-essential
3827
39- # install poetry - respects $POETRY_VERSION & $POETRY_HOME
40- # The --mount will mount the buildx cache directory to where
41- # Poetry and Pip store their cache so that they can re-use it
28+ # install uv
4229RUN --mount=type=cache,target=/root/.cache \
43- curl -sSL https://install.python-poetry.org | python3 -
30+ curl -LsSf https://astral.sh/uv/install.sh | sh
31+
32+ ENV PATH="/root/.local/bin:$PATH"
4433
4534# copy project requirement files here to ensure they will be cached.
4635WORKDIR $PYSETUP_PATH
47- COPY poetry.lock pyproject.toml ./
36+ COPY pyproject.toml ./
4837
49- # install runtime deps - uses $POETRY_VIRTUALENVS_IN_PROJECT internally
38+ # install runtime deps
5039RUN --mount=type=cache,target=/root/.cache \
51- poetry install --with=dev
40+ uv venv $VENV_PATH && \
41+ uv pip install --python=$VENV_PATH -e .[dev]
5242
5343FROM python:3.12-slim-bookworm as runtime
5444
55- ENV POETRY_HOME="/opt/poetry" \
56- VENV_PATH="/opt/pysetup/.venv"
57- ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH"
45+ ENV VENV_PATH="/opt/pysetup/.venv"
46+ ENV PATH="$VENV_PATH/bin:$PATH"
5847
5948COPY --from=builder-base $PYSETUP_PATH $PYSETUP_PATH
6049COPY ./pgmq_sqlalchemy /pgmq_sqlalchemy_test/pgmq_sqlalchemy
0 commit comments