Skip to content

Commit 6a4d430

Browse files
committed
Ensure write access to POETRY_CACHE_DIR
1 parent 9020314 commit 6a4d430

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Python
22
**/__pycache__
3-
.venv
3+
**/.venv
44

55
# Django
66
**/.env

Dockerfile

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,19 @@ RUN poetry install --without dev --no-root && rm -rf $POETRY_CACHE_DIR
3535
# Alpine doesn't support playwright
3636
FROM python:3.13.7-slim AS development
3737

38-
# Set up user like python_base does
38+
ENV UID=1000
3939
ENV USER=app
40-
RUN addgroup --gid 1000 --system ${USER} \
41-
&& adduser --uid 1000 --system ${USER} --ingroup ${USER} --home /home/${USER} \
42-
&& mkdir -p /home/${USER} \
43-
&& chown ${USER}:${USER} /home/${USER}
44-
45-
ENV HOME=/home/${USER}
40+
ENV APP_DIR=/app
41+
RUN addgroup --gid $UID --system ${USER} \
42+
&& adduser --uid $UID --system ${USER} --ingroup ${USER} \
43+
&& mkdir -p ${APP_DIR} \
44+
&& chown ${USER}:${USER} ${APP_DIR}
4645

47-
ENV VIRTUAL_ENV=/app/.venv
48-
ENV PATH="/app/.venv/bin:$PATH"
46+
ENV VIRTUAL_ENV=${APP_DIR}/.venv
47+
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
4948

5049
USER root
51-
WORKDIR /app
50+
WORKDIR ${APP_DIR}
5251

5352
# Install system dependencies needed for Playwright
5453
RUN apt-get update && apt-get install -y \
@@ -79,11 +78,12 @@ RUN apt-get update && apt-get install -y \
7978

8079
ENV POETRY_NO_INTERACTION=1 \
8180
POETRY_VIRTUALENVS_IN_PROJECT=1 \
82-
POETRY_VIRTUALENVS_CREATE=1
81+
POETRY_VIRTUALENVS_CREATE=1 \
82+
POETRY_CACHE_DIR=/tmp/poetry_cache
8383

8484
COPY pyproject.toml poetry.lock ./
8585
RUN pip install poetry
86-
RUN poetry install --no-root
86+
RUN poetry install --no-root && rm -rf $POETRY_CACHE_DIR
8787
RUN poetry run playwright install --with-deps chromium
8888

8989
USER ${USER}

makefiles/dev.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.PHONY: dev-run dev-up dev-down dev-logs dev-shell dev-migrate dev-makemigrations dev-clean dev-test
22

3-
DOCKER_COMPOSE_CMD = docker compose
3+
UID=$(shell id -u)
4+
DOCKER_COMPOSE_CMD = env UID=$(UID) docker compose
45

56
dev-build:
67
$(DOCKER_COMPOSE_CMD) build

0 commit comments

Comments
 (0)