Skip to content

Commit e8d3eb2

Browse files
authored
chore(docker): scan the image for secrets with Trivy, remove check_layers.js (#44188)
1 parent 9c013a2 commit e8d3eb2

7 files changed

Lines changed: 15 additions & 238 deletions

File tree

‎.github/workflows/tests_docker.yml‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,15 @@ jobs:
4545
- run: npm run build
4646
- run: ./utils/docker/build.sh --${{ matrix.docker_arch }} ${{ matrix.docker_tag }} playwright:localbuild
4747
shell: bash
48-
- run: ./utils/docker/test_check_layers.sh
49-
shell: bash
48+
# The scan looks at the content of the files, in all layers of the image.
49+
- name: Scan the image for secrets
50+
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
51+
with:
52+
image-ref: playwright:localbuild
53+
scanners: secret
54+
exit-code: '1'
55+
# The secret scan needs no vulnerability database.
56+
cache: 'false'
5057
- name: Launch container
5158
run: |
5259
docker run \

‎utils/docker/Dockerfile.jammy‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ ARG PLAYWRIGHT_VERSION
1010
# npm writes its cache and logs here during the build. /dev/shm is a tmpfs,
1111
# so no image layer keeps them. The image itself uses the default ~/.npm.
1212
ARG npm_config_cache=/dev/shm/npm
13+
# npm turns on the Node.js compile cache, which writes to /tmp. Turn it off during the build.
14+
ARG NODE_DISABLE_COMPILE_CACHE=1
1315

1416
ENV LANG=C.UTF-8
1517
ENV LC_ALL=C.UTF-8

‎utils/docker/Dockerfile.noble‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ ARG PLAYWRIGHT_VERSION
1010
# npm writes its cache and logs here during the build. /dev/shm is a tmpfs,
1111
# so no image layer keeps them. The image itself uses the default ~/.npm.
1212
ARG npm_config_cache=/dev/shm/npm
13+
# npm turns on the Node.js compile cache, which writes to /tmp. Turn it off during the build.
14+
ARG NODE_DISABLE_COMPILE_CACHE=1
1315

1416
ENV LANG=C.UTF-8
1517
ENV LC_ALL=C.UTF-8

‎utils/docker/Dockerfile.resolute‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ ARG PLAYWRIGHT_VERSION
1010
# npm writes its cache and logs here during the build. /dev/shm is a tmpfs,
1111
# so no image layer keeps them. The image itself uses the default ~/.npm.
1212
ARG npm_config_cache=/dev/shm/npm
13+
# npm turns on the Node.js compile cache, which writes to /tmp. Turn it off during the build.
14+
ARG NODE_DISABLE_COMPILE_CACHE=1
1315

1416
ENV LANG=C.UTF-8
1517
ENV LC_ALL=C.UTF-8

‎utils/docker/build.sh‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ for ((attempt = 1; attempt <= MAX_ATTEMPTS; attempt++)); do
6060
--build-arg PLAYWRIGHT_VERSION="${PLAYWRIGHT_VERSION}" \
6161
"${SECRET_ARGS[@]}" \
6262
-t "$3" -f "Dockerfile.$2" .; then
63-
# A failure of this check is not transient, so it does not retry the build.
64-
node ./check_layers.js "$3"
6563
exit 0
6664
fi
6765
if (( attempt < MAX_ATTEMPTS )); then

‎utils/docker/check_layers.js‎

Lines changed: 0 additions & 168 deletions
This file was deleted.

‎utils/docker/test_check_layers.sh‎

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)