webology,
@webology@mastodon.social avatar

🤔 My base, batteries included docker build is ~237MB, but when I add the #playwright #python image (plus a Chrome install), it bumps up to 2.64GB.

➡️ Not sure if anyone out there has optimized this before, but I am all ears.

LucidDan,

@webology when you run “playwright install-deps”, and “playwright install”, are specifying the browser you want? For production usage you prob only want one, by default it’ll install everything it possibly can. From memory, Chromium alone should be eg ~150Mb including apt dependencies on a python-slim docket image.

webology,
@webology@mastodon.social avatar

@LucidDan I used the MS Python image with one “playwright install chrome”. It's just a bloated default I suspect.

satya,
@satya@mas.to avatar

@webology That’s the reason I run Playwright in it’s own container. It doesn’t change that often.

webology,
@webology@mastodon.social avatar

@satya that's what I'm doing too. The main app runs in that ~200MB and then I use the playwright image as a worker of sorts. I just hate using a bloated/unoptimized image in production if I can avoid it.

satya,
@satya@mas.to avatar

@webology The browsers and their dependencies are probably the majority of that. You could probably build a slimmed down one if you include only one browser. Production use shouldn’t need all of them?

webology,
@webology@mastodon.social avatar

@satya I thought I was only getting Chrome but I will rebuild with other options and compare. You might be right that they are bundling more than I asked for.

satya,
@satya@mas.to avatar

@webology Your post inspired me to look at my Playwright image again. I got it down to 1GB. Here's a gist with Dockerfile https://gist.github.com/snmishra/9290d898122a05fd332289adf516c481

webology,
@webology@mastodon.social avatar

@satya Since I'm using it from Python, I was starting with the official "mcr.microsoft.com/playwright/python:v1.32.0-jammy" because I have never been able to get it to work with Python's default image.

Thanks for sharing this. Maybe I can use it as a starting point to try again.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • programming
  • DreamBathrooms
  • ngwrru68w68
  • cubers
  • magazineikmin
  • thenastyranch
  • rosin
  • khanakhh
  • InstantRegret
  • Youngstown
  • slotface
  • Durango
  • kavyap
  • mdbf
  • tacticalgear
  • JUstTest
  • osvaldo12
  • normalnudes
  • tester
  • cisconetworking
  • everett
  • GTA5RPClips
  • ethstaker
  • anitta
  • Leos
  • provamag3
  • modclub
  • megavids
  • lostlight
  • All magazines