question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] Docker browsers are downloading during npm ci command

See original GitHub issue

Hi, 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:closed
  • Created 3 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
mxschmittcommented, Dec 22, 2020

@viraxslot Thanks for confirming!

1reaction
mxschmittcommented, Oct 29, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found