Skip to content

Commit 014d02a

Browse files
committed
PPHA-494: Move development docker to its own Dockerfile
1 parent 06d6ffb commit 014d02a

File tree

3 files changed

+59
-58
lines changed

3 files changed

+59
-58
lines changed

Dockerfile

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
1919
RUN addgroup --gid 1000 --system ${USER} \
2020
&& adduser --uid 1000 --system ${USER} --ingroup ${USER}
2121

22+
2223
FROM python_base AS builder
2324

2425
WORKDIR /app
@@ -32,63 +33,6 @@ COPY pyproject.toml poetry.lock ./
3233
RUN pip install poetry
3334
RUN poetry install --without dev --no-root && rm -rf $POETRY_CACHE_DIR
3435

35-
# Alpine doesn't support playwright
36-
FROM python:3.14.1-slim AS development
37-
38-
ARG UID=1000
39-
ENV USER=app
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}
45-
46-
ENV VIRTUAL_ENV=${APP_DIR}/.venv
47-
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
48-
49-
USER root
50-
WORKDIR ${APP_DIR}
51-
52-
# Install system dependencies needed for Playwright
53-
RUN apt-get update && apt-get install -y \
54-
fonts-liberation \
55-
libasound2 \
56-
libatk-bridge2.0-0 \
57-
libatk1.0-0 \
58-
libatspi2.0-0 \
59-
libcups2 \
60-
libdbus-1-3 \
61-
libdrm2 \
62-
libexpat1 \
63-
libgbm1 \
64-
libglib2.0-0 \
65-
libgtk-3-0 \
66-
libnspr4 \
67-
libnss3 \
68-
libx11-6 \
69-
libxcomposite1 \
70-
libxdamage1 \
71-
libxext6 \
72-
libxfixes3 \
73-
libxrandr2 \
74-
libxss1 \
75-
libxtst6 \
76-
xdg-utils \
77-
&& rm -rf /var/lib/apt/lists/*
78-
79-
ENV POETRY_NO_INTERACTION=1 \
80-
POETRY_VIRTUALENVS_IN_PROJECT=1 \
81-
POETRY_VIRTUALENVS_CREATE=1 \
82-
POETRY_CACHE_DIR=/tmp/poetry_cache \
83-
PLAYWRIGHT_BROWSERS_PATH=${APP_DIR}/browsers
84-
85-
COPY pyproject.toml poetry.lock ./
86-
RUN pip install poetry
87-
RUN poetry install --no-root && rm -rf $POETRY_CACHE_DIR
88-
RUN poetry run playwright install --with-deps chromium
89-
90-
USER ${USER}
91-
COPY --chown=${USER}:${USER} . .
9236

9337
FROM python_base
9438

Dockerfile.dev

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Alpine doesn't support playwright
2+
FROM python:3.14.1-slim AS development
3+
4+
ARG UID=1000
5+
ENV USER=app
6+
ENV APP_DIR=/app
7+
RUN addgroup --gid $UID --system ${USER} \
8+
&& adduser --uid $UID --system ${USER} --ingroup ${USER} \
9+
&& mkdir -p ${APP_DIR} \
10+
&& chown ${USER}:${USER} ${APP_DIR}
11+
12+
ENV VIRTUAL_ENV=${APP_DIR}/.venv
13+
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
14+
15+
USER root
16+
WORKDIR ${APP_DIR}
17+
18+
# Install system dependencies needed for Playwright
19+
RUN apt-get update && apt-get install -y \
20+
fonts-liberation \
21+
libasound2 \
22+
libatk-bridge2.0-0 \
23+
libatk1.0-0 \
24+
libatspi2.0-0 \
25+
libcups2 \
26+
libdbus-1-3 \
27+
libdrm2 \
28+
libexpat1 \
29+
libgbm1 \
30+
libglib2.0-0 \
31+
libgtk-3-0 \
32+
libnspr4 \
33+
libnss3 \
34+
libx11-6 \
35+
libxcomposite1 \
36+
libxdamage1 \
37+
libxext6 \
38+
libxfixes3 \
39+
libxrandr2 \
40+
libxss1 \
41+
libxtst6 \
42+
xdg-utils \
43+
&& rm -rf /var/lib/apt/lists/*
44+
45+
ENV POETRY_NO_INTERACTION=1 \
46+
POETRY_VIRTUALENVS_IN_PROJECT=1 \
47+
POETRY_VIRTUALENVS_CREATE=1 \
48+
POETRY_CACHE_DIR=/tmp/poetry_cache \
49+
PLAYWRIGHT_BROWSERS_PATH=${APP_DIR}/browsers
50+
51+
COPY pyproject.toml poetry.lock ./
52+
RUN pip install poetry
53+
RUN poetry install --no-root && rm -rf $POETRY_CACHE_DIR
54+
RUN poetry run playwright install --with-deps chromium
55+
56+
USER ${USER}
57+
COPY --chown=${USER}:${USER} . .

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ services:
44
web:
55
build:
66
context: .
7-
dockerfile: Dockerfile
7+
dockerfile: Dockerfile.dev
88
target: development
99
command: python manage.py runserver 0.0.0.0:8000
1010
ports:

0 commit comments

Comments
 (0)