From 1a836c9479928496d6577ba32e24165eaa25cdea Mon Sep 17 00:00:00 2001 From: i544693 <369491420@qq.com> Date: Fri, 10 Dec 2021 01:55:30 +0800 Subject: [PATCH] test:docker locally. --- Dockerfile | 9 +++++++++ package.json | 8 +++++++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..b07a97ce --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM mcr.microsoft.com/playwright:focal +WORKDIR /app +COPY . . +RUN rm package-lock.json +RUN npm install +RUN npx playwright install +RUN npm run build +ENTRYPOINT ["npm", "run"] +CMD ["test"] \ No newline at end of file diff --git a/package.json b/package.json index cc435fde..ba513ce9 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,13 @@ "prepare": "npm run build", "pub:next": "cross-env RELEASE_TAG=next sh build/release.sh", "pub": "sh build/release.sh", - "postinstall": "opencollective-postinstall" + "postinstall": "opencollective-postinstall", + "docker:build": "docker build -f Dockerfile -t docsify-test:local .", + "docker:clean": "docker rmi docsify-test:local", + "docker:test": "docker run --rm -it --ipc=host --user pwuser docsify-test:local test", + "docker:test:e2e": "docker run --rm -it --ipc=host --user pwuser docsify-test:local test:e2e", + "docker:test:integration": "docker run --rm -it --ipc=host --user pwuser ddocsify-test:local test:integration", + "docker:test:unit": "docker run --rm -it --ipc=host --user pwuser docsify-test:local test:unit" }, "husky": { "hooks": {