mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-15 14:11:50 +03:00
a06ba1c770
This adds a new script to calculate docker image size with all parent layers. Note: take this metrics with a grain of salt, since in reality docker compresses and reuses layers. Some historic stats obtained with this script: - **`208MB`** (-33MB) chore(docker): skip "recommended" dependencies (#2917) (1cebf8757c
) - **`241MB`** (-29MB) chore(docker): trim some of the gstreamer dependencies (#2897) (bce4b1aea9
) - **`272MB`** (-1MB) devops: do cache busting for APT (#2656) (bb34418095
) - **`273MB`** (+49MB) fix(webkit): update Docker file to include gstreamer (#2636) (5c6c65915c
) - **`224MB`** (+0MB) chore: fix emojis for CR and FF in Dockerfile (#2522) (24316ad261
) - **`224MB`** (-1MB) fix: Dockerfile for Firefox (#1937) (b516ac4fb2
) - **`225MB`** (+49MB) devops(docker): Install ffmpeg dependency, adding codecs necessary for video playback in Firefox (#1627) (222d01caaa
) - **`176MB`** (+32MB) chore(docs): optionally install XVFB in docker(ec3ee66043
) - **`144MB`** (+144MB) feat: add a playwright-ready docker image (#1161)(1781ae7006
)
33 lines
1004 B
Bash
Executable File
33 lines
1004 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
set +x
|
|
|
|
# This script computes **compressed image size with all its layers**.
|
|
# This solution is based on https://stackoverflow.com/a/55156181/314883
|
|
|
|
DOCKER_IMAGE_NAME="docker-image-to-count-compressed-size"
|
|
FILE_NAME="docker-image-to-count-compressed-size"
|
|
|
|
function cleanup() {
|
|
echo "-- Removing .tar if any"
|
|
rm -f "${FILE_NAME}.tar"
|
|
echo "-- Removing .tar.gz if any"
|
|
rm -f "${FILE_NAME}.tar.gz"
|
|
echo "-- Removing docker image if any"
|
|
docker rmi "${DOCKER_IMAGE_NAME}:bionic" >/dev/null
|
|
}
|
|
|
|
trap "cleanup; cd $(pwd -P)" EXIT
|
|
cd "$(dirname "$0")"
|
|
|
|
echo "-- Building image..."
|
|
docker build -t "${DOCKER_IMAGE_NAME}:bionic" -f Dockerfile.bionic . >/dev/null
|
|
echo "-- Saving .tar of the image..."
|
|
docker save "${DOCKER_IMAGE_NAME}:bionic" > "${FILE_NAME}.tar"
|
|
echo "-- Compressing image..."
|
|
gzip "${FILE_NAME}.tar" >/dev/null
|
|
|
|
echo "(generated with docker-image-size.sh)" > CURRENT_DOCKER_IMAGE_SIZE
|
|
du -sh ${FILE_NAME}.tar.gz | cut -f1 | xargs >> CURRENT_DOCKER_IMAGE_SIZE
|
|
|