Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change to using Playwright's official docker image #132

Merged
merged 2 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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