perf: Reduce docker image (#1064)

* Add .dockerignore file to clean image building area

* Optimize docker image build
This commit is contained in:
stanclai 2019-03-02 22:33:16 +01:00 committed by Nolan Lawson
parent fe0018262f
commit c1df934c55
2 changed files with 27 additions and 7 deletions

18
.dockerignore Normal file
View File

@ -0,0 +1,18 @@
.git
BREAKING_CHANGES.md
CONTRIBUTING.md
docs
README.md
tests
.DS_Store
/node_modules
/__sapper__
/mastodon
/mastodon.log
/src/template.html
/static/*.css
/static/robots.txt
/static/inline-script.js.map
/static/emoji-mart-all.json
/src/inline-script/checksum.js
yarn-error.log

View File

@ -6,15 +6,17 @@ WORKDIR /app
ADD . /app ADD . /app
# Install updates and NodeJS+Dependencies # Install updates and NodeJS+Dependencies
RUN apk update && apk upgrade RUN apk add --update --no-cache --virtual build-dependencies git python build-base clang \
RUN apk add nodejs npm git python build-base clang # Install updates and NodeJS+Dependencies
&& apk add --update --no-cache nodejs npm \
# Install yarn # Install yarn
RUN npm i yarn -g && npm i yarn -g \
# Install Pinafore # Install Pinafore
RUN yarn --pure-lockfile && yarn --pure-lockfile \
RUN yarn build && yarn build \
&& rm -rf ./src \
# Cleanup
&& apk del build-dependencies
# Expose port 4002 # Expose port 4002
EXPOSE 4002 EXPOSE 4002