mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-14 13:45:36 +03:00
fix(docker): add pwuser to Docker focal image (#4201)
This commit is contained in:
parent
72320275ab
commit
8f3c0d5420
@ -60,6 +60,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
RUN apt-get update && apt-get install -y --no-install-recommends git ssh && \
|
RUN apt-get update && apt-get install -y --no-install-recommends git ssh && \
|
||||||
npm install -g yarn
|
npm install -g yarn
|
||||||
|
|
||||||
|
# 9. Create the pwuser (we internally create a symlink for the pwuser and the root user)
|
||||||
|
RUN adduser pwuser
|
||||||
|
|
||||||
# === BAKE BROWSERS INTO IMAGE ===
|
# === BAKE BROWSERS INTO IMAGE ===
|
||||||
|
|
||||||
# 1. Add tip-of-tree Playwright package to install its browsers.
|
# 1. Add tip-of-tree Playwright package to install its browsers.
|
||||||
@ -67,7 +70,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends git ssh && \
|
|||||||
COPY ./playwright.tar.gz /tmp/playwright.tar.gz
|
COPY ./playwright.tar.gz /tmp/playwright.tar.gz
|
||||||
|
|
||||||
# 2. Install playwright and then delete the installation.
|
# 2. Install playwright and then delete the installation.
|
||||||
# Browsers will remain downloaded in `/root/.cache/ms-playwright`.
|
# Browsers will remain downloaded in `/home/pwuser/.cache/ms-playwright`.
|
||||||
RUN mkdir /tmp/pw && cd /tmp/pw && npm init -y && \
|
RUN su pwuser -c "mkdir /tmp/pw && cd /tmp/pw && npm init -y && \
|
||||||
npm i /tmp/playwright.tar.gz && \
|
npm i /tmp/playwright.tar.gz" && \
|
||||||
rm -rf /tmp/pw && rm /tmp/playwright.tar.gz
|
rm -rf /tmp/pw && rm /tmp/playwright.tar.gz
|
||||||
|
|
||||||
|
# 3. Symlink downloaded browsers for root user
|
||||||
|
RUN mkdir /root/.cache/ && \
|
||||||
|
ln -s /home/pwuser/.cache/ms-playwright/ /root/.cache/ms-playwright
|
||||||
|
Loading…
Reference in New Issue
Block a user