我们有这个Dockerfile:
FROM mcr.microsoft.com/playwright:v1.20.0-focal
ADD ./sometest.e2e.spec.js /
RUN yarn add playwright &&
PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers npx playwright install &&
yarn add @playwright/test
RUN PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers ./node_modules/playwright/node_modules/.bin/playwright test
当我们尝试构建时,在比特桶管道(依次使用图像docker:20.10.8-alpine3.13(期间,会发生以下错误:
...
Step 4/4 : RUN PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers ./node_modules/playwright/node_modules/.bin/playwright test
---> Running in d8a3b2a2d013
[Error: EACCES: permission denied, scandir '/proc/tty/driver'] {
errno: -13,
code: 'EACCES',
syscall: 'scandir',
path: '/proc/tty/driver'
}
在本地它是有效的,但在管道中,即使我做了一个简单的";ls〃;在/proc/tty/driver文件夹中的命令,它在权限被拒绝的情况下崩溃。
有什么建议吗?非常感谢。
我使用的是根目录,我创建了一个非根目录,问题就解决了!
FROM mcr.microsoft.com/playwright:v1.25.0-focal
RUN mkdir /playwright
ADD ./sometest.e2e.spec.js /playwright
RUN cd /playwright &&
yarn add playwright &&
PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers npx playwright install &&
yarn add @playwright/test
RUN cd /playwright && PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers ./node_modules/playwright/node_modules/.bin/playwright test
谢谢!!