Skip to content

Commit

Permalink
improvement: gzip static files in docker image (via #1953)
Browse files Browse the repository at this point in the history
  • Loading branch information
yodeyer authored and shockey committed Feb 26, 2019
1 parent 16870f4 commit 731df8e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/.git
/.github
/dev-helpers
/docs
/src
/swagger-editor-dist-package
/test
/node_modules
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ ADD ./dist/*.css /usr/share/nginx/html/dist/
ADD ./dist/*.png /usr/share/nginx/html/dist/
ADD ./docker-run.sh /usr/share/nginx/

RUN find /usr/share/nginx/html/ -type f -regex ".*\.\(html\|js\|css\)" -exec sh -c "gzip < {} > {}.gz" \;

EXPOSE 8080

CMD ["sh", "/usr/share/nginx/docker-run.sh"]
7 changes: 7 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ http {

keepalive_timeout 65;

gzip on;
gzip_static on;
gzip_disable "msie6";

gzip_vary on;
gzip_types text/plain text/css application/javascript;

server {
listen 8080;
server_name localhost;
Expand Down

0 comments on commit 731df8e

Please sign in to comment.