Skip to content

Commit 661152d

Browse files
committed
clarify poetry venv usage
1 parent 72908ad commit 661152d

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

Dockerfile

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,19 @@ WORKDIR /code
2828
ENV POETRY_NO_INTERACTION=1 \
2929
POETRY_VIRTUALENVS_OPTIONS_ALWAYS_COPY=1 \
3030
POETRY_VIRTUALENVS_CREATE=0 \
31-
POETRY_VIRTUALENVS_IN_PROJECT=1 \
31+
POETRY_VIRTUALENVS_IN_PROJECT=0 \
3232
POETRY_CACHE_DIR=/tmp/poetry-cache \
33-
POETRY_HOME=/tmp/poetry
33+
POETRY_VENV=/poetry_venv
3434

35-
RUN python -m venv $POETRY_HOME
35+
RUN python -m venv $POETRY_VENV
3636

37-
RUN $POETRY_HOME/bin/pip install poetry==2.1.1
37+
RUN $POETRY_VENV/bin/pip install poetry==2.1.1
3838

3939
COPY pyproject.toml .
4040
COPY poetry.lock .
4141

42-
RUN $POETRY_HOME/bin/poetry install --compile
42+
# note: installs dependencies on the system, not in poetry's venv
43+
RUN $POETRY_VENV/bin/poetry install --compile
4344

4445
RUN apt-get remove -y \
4546
gcc \
@@ -59,9 +60,9 @@ CMD ["python", "manage.py", "--help"]
5960
### Dist
6061
FROM app AS dist
6162

62-
RUN $POETRY_HOME/bin/poetry install --compile --only dist
63+
RUN $POETRY_VENV/bin/poetry install --compile --only dist
6364

6465
### Dev
6566
FROM app AS dev
6667

67-
RUN $POETRY_HOME/bin/poetry install --compile --only dev
68+
RUN $POETRY_VENV/bin/poetry install --compile --only dev

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ services:
151151
- -c
152152
- apt-get update &&
153153
apt-get install -y gcc &&
154-
$$POETRY_HOME/bin/poetry install --compile --with dev &&
154+
$$POETRY_VENV/bin/poetry install --compile --with dev &&
155155
rm -Rf /python3.13/* &&
156156
apt-get remove -y gcc &&
157157
cp -Rf -p /usr/local/lib/python3.13 /

0 commit comments

Comments
 (0)