[Question] Docker browsers are downloading during npm ci command
See original GitHub issueHi, team! I use 2 docker images because I want to install playwright and download browsers once in base
image and then only run test cases.
Base image:
FROM mcr.microsoft.com/playwright:v1.5.2
USER root
RUN mkdir -p /home/tests
WORKDIR /home/tests
COPY package.json .
COPY package-lock.json .
COPY policies/policies.json /etc/firefox/policies
RUN mkdir -p /etc/chromium/policies/managed
COPY policies/chromiumPolicy.json /etc/chromium/policies/managed
RUN npm i
Image for running tests:
FROM artifactory/playwright-base:latest
USER root
WORKDIR /home/tests
COPY . .
RUN npm ci && chmod 777 entrypoint.sh
CMD ["/bin/bash", "./entrypoint.sh"]
When I run my tests using 2nd image I see in logs
12:47:55 > playwright@1.5.2 install /home/tests/node_modules/playwright
12:47:55 > node install.js
12:47:55
12:47:55 Removing unused browser at /root/.cache/ms-playwright/chromium-799411
12:47:56 Removing unused browser at /root/.cache/ms-playwright/firefox-1171
12:47:56 Removing unused browser at /root/.cache/ms-playwright/webkit-1343
12:47:57
12:47:57 chromium v815036 downloaded to /root/.cache/ms-playwright/chromium-815036
12:48:06
12:48:06 firefox v1188 downloaded to /root/.cache/ms-playwright/firefox-1188
12:48:10
12:48:10 webkit v1347 downloaded to /root/.cache/ms-playwright/webkit-1347
As I can understand browsers are downloading on this stage. What am I doing wrong? Thanks in advance.
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (7 by maintainers)
Top Results From Across the Web
Dockerfile use npm cache - Stack Overflow
json package-lock.json ./ is working, it only is executing RUN npm ci when one of the jsons changes. But I want to use...
Read more >How to Set Up Your Local Node.js Development Environment
The first thing we want to do is download the code to our local development machine. Let's do this using the following git...
Read more >Introduction to Docker for Javascript Developers (feat Node.js ...
Run the following command to download the hello-world image: ... that your Node app reloads and you see the change in your browser...
Read more >Using the official AWS CLI version 2 Amazon ECR Public ...
Run the official AWS CLI version 2 images. The first time you use the docker run command, the latest image is downloaded to...
Read more >A Docker Tutorial for Beginners
In the demo above, we used the docker pull command to download the busybox image. ... This is the question we'll be exploring...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@viraxslot Thanks for confirming!
The Docker image tag and the Playwright version in the package.json need to match otherwise the browsers get re-downloaded. From what I’ve seen in your details this looks fine.
I tried to compare the browsers in the Docker image (
mcr.microsoft.com/playwright:v1.5.2
) with the browser revisions in the NPM version (https://unpkg.com/playwright@1.5.2/browsers.json). They match, so I guess that on your environment it might be a Docker layer caching issue since your base image has the Chromium revision 799411 which is not v1.5.2.