| 
									
										
										
										
											2020-07-17 16:51:39 -07:00
										 |  |  | #!/bin/bash
 | 
					
						
							|  |  |  | set -e | 
					
						
							|  |  |  | set +x | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-21 17:47:44 +02:00
										 |  |  | if [[ ($1 == '--help') || ($1 == '-h') || ($1 == '') || ($2 == '') ]]; then | 
					
						
							| 
									
										
										
										
											2020-12-08 10:36:37 -08:00
										 |  |  |   echo "usage: $(basename $0) {bionic,focal} playwright:localbuild-focal" | 
					
						
							| 
									
										
										
										
											2020-07-17 16:51:39 -07:00
										 |  |  |   echo | 
					
						
							| 
									
										
										
										
											2020-12-08 10:36:37 -08:00
										 |  |  |   echo "Build Playwright docker image and tag it as 'playwright:localbuild-focal'." | 
					
						
							| 
									
										
										
										
											2020-07-17 16:51:39 -07:00
										 |  |  |   echo "Once image is built, you can run it with" | 
					
						
							|  |  |  |   echo "" | 
					
						
							| 
									
										
										
										
											2020-12-08 10:36:37 -08:00
										 |  |  |   echo "  docker run --rm -it playwright:localbuild-focal /bin/bash" | 
					
						
							| 
									
										
										
										
											2020-07-17 16:51:39 -07:00
										 |  |  |   echo "" | 
					
						
							|  |  |  |   echo "NOTE: this requires on Playwright dependencies to be installed with 'npm install'" | 
					
						
							|  |  |  |   echo "      and Playwright itself being built with 'npm run build'" | 
					
						
							|  |  |  |   echo "" | 
					
						
							|  |  |  |   exit 0 | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function cleanup() { | 
					
						
							| 
									
										
										
										
											2020-09-01 11:33:19 -07:00
										 |  |  |   rm -f "playwright.tar.gz" | 
					
						
							| 
									
										
										
										
											2020-07-17 16:51:39 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | trap "cleanup; cd $(pwd -P)" EXIT | 
					
						
							|  |  |  | cd "$(dirname "$0")" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-11 10:52:17 -04:00
										 |  |  | # We rely on `./playwright-core.tar.gz` to download browsers into the docker | 
					
						
							| 
									
										
										
										
											2020-07-17 16:51:39 -07:00
										 |  |  | # image. | 
					
						
							| 
									
										
										
										
											2021-10-11 10:52:17 -04:00
										 |  |  | node ../../utils/pack_package.js playwright-core ./playwright-core.tar.gz | 
					
						
							| 
									
										
										
										
											2020-07-17 16:51:39 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-21 17:47:44 +02:00
										 |  |  | docker build -t "$2" -f "Dockerfile.$1" . |