Skip to content

Commit

Permalink
change to using Playwright's official docker image (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuadavidthomas authored Apr 26, 2024
1 parent 9234056 commit 4cbddac
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Pinned Django in `requirements.in` to less than the next major release based on the version chosen when answering copier questions.
- Added more ignore rules to `.gitignore` pertaining to SQLite, PostgreSQL, and other database files.

### Changed

- Now using official Playwright Docker image provided my Microsoft, instead of installing manually inside project's `Dockerfile`. The build times when updating any Python dependency got to be too long to deal with, so instead we pin which version of Playwright to use in both `requirements.in` and the aforementioned `Dockerfile` so there is no drift between the two.

## [2024.16]

### Added
Expand Down
5 changes: 5 additions & 0 deletions copier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ tailwindcss_version:
help: Which version of Tailwind CSS should be used?
default: "3.4.0"

playwright_version:
type: str
help: Which version of Playwright should be used?
default: "1.43.0"

# ----------------------------------------------------------------------
# DEPENDENCIES
# ----------------------------------------------------------------------
Expand Down
10 changes: 2 additions & 8 deletions src/django_twc_project/Dockerfile.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,6 @@ RUN --mount=type=cache,target=/root/.cache/pip --mount=type=cache,target=/root/.
&& uv pip install -r requirements.txt


FROM py as playwright
ENV PLAYWRIGHT_BROWSERS_PATH /usr/local/bin/playwright-browsers
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked --mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update --fix-missing \
&& playwright install --with-deps


FROM node-base as node
COPY --from=py --link /usr/local /usr/local
COPY --link package*.json /app
Expand Down Expand Up @@ -110,7 +103,8 @@ COPY --link {{ module_name }} /app/{{ module_name }}
COPY --link templates /app/templates


FROM playwright as dev
FROM mcr.microsoft.com/playwright/python:v{{ playwright_version }} as dev
COPY --from=py --link /usr/local /usr/local
COPY --from=app --link /app /app


Expand Down
2 changes: 1 addition & 1 deletion src/django_twc_project/requirements.in.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ httpx
ipython
model_bakery
mypy
playwright
playwright=={{ playwright_version }}
pre-commit
psycopg
psycopg-binary
Expand Down

0 comments on commit 4cbddac

Please sign in to comment.