@@ -34,49 +34,43 @@ ENV LC_ALL en_US.utf-8
3434ENV LANG en_US.utf-8
3535
3636# https://python-poetry.org/docs/configuration/#using-environment-variables
37- ENV POETRY_VERSION=1.8.2 \
38- POETRY_HOME="/opt/poetry" \
37+ ENV POETRY_VERSION=2.1.1 \
3938 POETRY_VIRTUALENVS_IN_PROJECT=true \
4039 PYSETUP_PATH="/opt/pysetup" \
41- VENV_PATH="/opt/pysetup/.venv"
40+ VENV_PATH="/opt/pysetup/.venv" \
41+ PIPX_ROOT_PATH="/root/.local/bin"
4242
43- # Prepend venv and poetry to path
44- ENV PATH="$VENV_PATH/bin:$POETRY_HOME/bin:$PATH"
43+ # Install pipx and poetry
44+ RUN python3 -m pip install --user pipx && python3 -m pipx ensurepath
45+ ENV PATH="${PIPX_ROOT_PATH}:${VENV_PATH}/bin:$PATH"
46+ RUN pipx install poetry==2.1.1
4547
4648RUN groupadd --gid 816877 G-816877 && \
4749 useradd --uid 458981 --gid G-816877 -m --shell /bin/bash tg458981 -d /home/tg458981
4850
49- # Install poetry version $POETRY_VERSION to $POETRY_HOME
50- RUN pip3 install --no-cache-dir --upgrade pip setuptools wheel \
51- && python3 -m venv "$POETRY_HOME" \
52- && "$POETRY_HOME/bin/pip" install --no-cache-dir poetry=="$POETRY_VERSION"
53-
5451# Copy project requirement files here to ensure they will be cached.
5552WORKDIR $PYSETUP_PATH
56- COPY poetry.lock pyproject.toml ./
53+ COPY pyproject.toml poetry.lock ./
5754
5855# #############
5956# `development` image target is used for local development
6057FROM python-base as development
6158
62- RUN "$POETRY_HOME/bin/ poetry" install
59+ RUN poetry sync
6360
6461# Copy in base project directory without built client assets for local development
6562COPY --chown=tg458981:G-816877 . /srv/www/designsafe
6663
6764USER tg458981
6865
69- # Install dev dependencies
70- RUN "$POETRY_HOME/bin/poetry" install --with dev
71-
7266WORKDIR /srv/www/designsafe
7367
7468# #############
7569# `production` image target is used for deployed runtime environments
7670FROM python-base as production
7771
7872# Install runtime dependencies
79- RUN "$POETRY_HOME/bin/ poetry" install --without dev
73+ RUN poetry sync --without= dev
8074
8175# Copy in built client assets
8276COPY --from=node_build --chown=tg458981:G-816877 /designsafe/ /srv/www/designsafe
0 commit comments