-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.dev
More file actions
59 lines (51 loc) · 1.35 KB
/
Dockerfile.dev
File metadata and controls
59 lines (51 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Alpine doesn't support playwright
FROM python:3.14.1-slim
ARG UID=1000
ENV USER=app
ENV APP_DIR=/app
RUN addgroup --gid $UID --system ${USER} \
&& adduser --uid $UID --system ${USER} --ingroup ${USER} \
&& mkdir -p ${APP_DIR} \
&& chown ${USER}:${USER} ${APP_DIR}
ENV VIRTUAL_ENV=${APP_DIR}/.venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
USER root
WORKDIR ${APP_DIR}
# Install system dependencies needed for Playwright
RUN apt-get update && apt-get install -y \
fonts-liberation \
libasound2 \
libatk-bridge2.0-0 \
libatk1.0-0 \
libatspi2.0-0 \
libcups2 \
libdbus-1-3 \
libdrm2 \
libexpat1 \
libgbm1 \
libglib2.0-0 \
libgtk-3-0 \
libnspr4 \
libnss3 \
libx11-6 \
libxcomposite1 \
libxdamage1 \
libxext6 \
libxfixes3 \
libxrandr2 \
libxss1 \
libxtst6 \
xdg-utils \
&& rm -rf /var/lib/apt/lists/*
ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache \
PLAYWRIGHT_BROWSERS_PATH=${APP_DIR}/browsers
COPY pyproject.toml poetry.lock ./
RUN pip install poetry
RUN poetry install --no-root && rm -rf $POETRY_CACHE_DIR
RUN poetry run playwright install --with-deps chromium
USER ${USER}
COPY --chown=${USER}:${USER} . .
CMD ["/usr/bin/python", "manage.py", "runserver", "0.0.0.0:8000"]