Skip to content

Commit 7583b19

Browse files
committed
perf: use external playwright browser
1 parent 9db8449 commit 7583b19

File tree

6 files changed

+576
-517
lines changed

6 files changed

+576
-517
lines changed

.env

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ ENVIRONMENT=dev
33
DRIVER=~fastapi+~httpx+~websockets
44

55
SQLALCHEMY_SESSION_OPTIONS='{"expire_on_commit": false}'
6-
ALEMBIC_VERSION_LOCATIONS=migrations/versions
76

87
ALCONNA_USE_COMMAND_START=true
8+
9+
HTMLRENDER_CONNECT=ws://localhost:3000/chromium/playwright?launch={"args":["--disable-web-security"]}

Dockerfile

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
FROM python:slim
1+
FROM python:slim as base
22
WORKDIR /app
33
ENV PATH=.venv/bin:${PATH}
44

5-
RUN pip install pdm && pip cache purge
5+
6+
FROM base AS build
7+
ENV PDM_CHECK_UPDATE=false
8+
9+
RUN pip install pdm
610
COPY pyproject.toml pdm.lock ./
7-
RUN pdm sync -G docker --prod --no-editable && \
8-
pdm cache clear && \
9-
\
10-
pip freeze | xargs pip uninstall -y && \
11-
\
12-
playwright install chromium --with-deps && \
13-
apt clean && \
14-
rm -rf /var/lib/apt/lists/*
11+
RUN pdm sync --prod --no-editable
12+
13+
14+
FROM base
15+
16+
COPY --from=build /app/.venv/ .venv
1517
COPY . .
1618

1719
CMD nb orm upgrade && nb run

0 commit comments

Comments
 (0)