feat: smaller image (#4278)

This commit is contained in:
fengkx
2020-03-19 19:29:49 +08:00
committed by GitHub
parent 623056ef08
commit 77ccb135df
3 changed files with 21 additions and 4 deletions
+14 -1
View File
@@ -4,7 +4,6 @@ Dockerfile*
docker-compose*
.dockerignore
.gitignore
README.md
LICENSE
.vscode
.github
@@ -12,3 +11,17 @@ assets
coverage
docs
test
.codecov.yml
.eslint*
.prettier*
.(yarn|npm|nvm)rc
*.md
process.json
app.json
.travis.yml
#git but keep the git commit hash
.git/logs
.git/objects
.git/index
.git/info
+3 -3
View File
@@ -16,7 +16,7 @@ RUN apt-get update && apt-get install -yq libgconf-2-4 apt-transport-https git d
WORKDIR /app
COPY package.json /app
COPY package.json clean-nm.sh /app/
RUN if [ "$USE_CHINA_NPM_REGISTRY" = 1 ]; then \
echo 'use npm mirror'; npm config set registry https://registry.npm.taobao.org; \
@@ -33,10 +33,10 @@ RUN if [ "$PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" = 0 ]; then \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get purge --auto-remove -y wget\
&& rm -rf /src/*.deb \
&& npm install --production; \
&& npm install --production && sh ./clean-nm.sh;\
else \
export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true && \
npm install --production; \
npm install --production && sh ./clean-nm.sh;\
fi;
COPY . /app
+4
View File
@@ -0,0 +1,4 @@
#!/bin/sh
find ./node_modules -type f |grep -E "(.idea|.vscode|benchmark.js|.eslintrc.js|changelog|AUTHORS|license|LICENSE|LICENCE|.travis.yml|.eslintrc.json|.eslintrc.yml|Makefile|.npmignore|.DS_Store|.jshintrc|.eslintrc.BSD|.editorconfig|tsconfig.json|.coveralls.yml|appveyor.yml|.gitattributes|.eslintignore|.eslintrc|.eslintignore.BSD|.babelrc)" |xargs rm -rf;
find node_modules -type f | grep -E "\.(md|mdon|markdown|log|ts|swp|jst|coffee|txt|BSD|m?js.map)$" | xargs rm -f;
find node_modules -type d | grep -E "(examples|example|.githubs|@types)" | xargs rm -rf;