2020-09-21 17:47:44 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								FROM ubuntu:focal
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-10-19 16:10:24 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								ARG DEBIAN_FRONTEND=noninteractive
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								ARG TZ=America/Los_Angeles
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-25 15:45:53 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								ARG DOCKER_IMAGE_NAME_TEMPLATE="mcr.microsoft.com/playwright:v%version%-focal"
							 | 
						
					
						
							
								
									
										
										
										
											2021-10-19 16:10:24 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-08 10:36:37 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# === INSTALL Node.js ===
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-11-11 15:35:57 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								RUN apt-get update && \
							 | 
						
					
						
							
								
									
										
										
										
											2023-02-03 01:44:20 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    # Install Node 18
							 | 
						
					
						
							
								
									
										
										
										
											2022-07-25 12:49:51 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    apt-get install -y curl wget gpg && \
							 | 
						
					
						
							
								
									
										
										
										
											2023-01-26 16:34:32 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    curl -sL https://deb.nodesource.com/setup_18.x | bash - && \
							 | 
						
					
						
							
								
									
										
										
										
											2021-11-11 15:35:57 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    apt-get install -y nodejs && \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    # Feature-parity with node.js base images.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    apt-get install -y --no-install-recommends git openssh-client && \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    npm install -g yarn && \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    # clean apt cache
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    rm -rf /var/lib/apt/lists/* && \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    # Create the pwuser
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    adduser pwuser
							 | 
						
					
						
							
								
									
										
										
										
											2021-10-19 16:10:24 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-09-21 17:47:44 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# === BAKE BROWSERS INTO IMAGE ===
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-02-11 18:33:30 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-09-21 17:47:44 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# 1. Add tip-of-tree Playwright package to install its browsers.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#    The package should be built beforehand from tip-of-tree Playwright.
							 | 
						
					
						
							
								
									
										
										
										
											2021-10-11 10:52:17 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								COPY ./playwright-core.tar.gz /tmp/playwright-core.tar.gz
							 | 
						
					
						
							
								
									
										
										
										
											2020-09-21 17:47:44 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-09-09 15:25:42 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# 2. Bake in Playwright Agent.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#    Playwright Agent is used to bake in browsers and browser dependencies,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#    and run docker server later on.
							 | 
						
					
						
							
								
									
										
										
										
											2021-10-19 16:10:24 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#    Browsers will be downloaded in `/ms-playwright`.
							 | 
						
					
						
							
								
									
										
										
										
											2021-03-01 17:24:07 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#    Note: make sure to set 777 to the registry so that any user can access
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#    registry.
							 | 
						
					
						
							
								
									
										
										
										
											2021-03-03 10:26:23 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								RUN mkdir /ms-playwright && \
							 | 
						
					
						
							
								
									
										
										
										
											2021-10-19 16:10:24 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    mkdir /ms-playwright-agent && \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    cd /ms-playwright-agent && npm init -y && \
							 | 
						
					
						
							
								
									
										
										
										
											2021-10-11 10:52:17 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    npm i /tmp/playwright-core.tar.gz && \
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-25 15:45:53 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    npx playwright mark-docker-image "${DOCKER_IMAGE_NAME_TEMPLATE}" && \
							 | 
						
					
						
							
								
									
										
										
										
											2021-11-11 15:35:57 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    npx playwright install --with-deps && rm -rf /var/lib/apt/lists/* && \
							 | 
						
					
						
							
								
									
										
										
										
											2021-10-19 16:10:24 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    rm /tmp/playwright-core.tar.gz && \
							 | 
						
					
						
							
								
									
										
										
										
											2021-03-01 17:24:07 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    chmod -R 777 /ms-playwright
							 |