perf: Reduce docker image (#1064)

* Add .dockerignore file to clean image building area

* Optimize docker image build
install-prod
stanclai 2019-03-02 22:33:16 +01:00 zatwierdzone przez Nolan Lawson
rodzic fe0018262f
commit c1df934c55
2 zmienionych plików z 27 dodań i 7 usunięć

18
.dockerignore 100644
Wyświetl plik

@ -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

Wyświetl plik

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