Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Brotli #41

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM node:lts as builder
RUN apt-get update && apt-get install brotli
WORKDIR app
RUN npm i -g @angular/cli
COPY package.json package-lock.json ./
Expand Down Expand Up @@ -33,7 +34,9 @@ RUN npm i -g @angular/cli
COPY --from=builder app ./
CMD ng test --karma-config karma-ci.conf.js

FROM nginx:alpine-slim as deploy
FROM ghcr.io/cjmalloy/docker-nginx-brotli:master as deploy
RUN sed -i '1i load_module /usr/lib/nginx/modules/ngx_http_brotli_filter_module.so;' /etc/nginx/nginx.conf
RUN sed -i '1i load_module /usr/lib/nginx/modules/ngx_http_brotli_static_module.so;' /etc/nginx/nginx.conf
WORKDIR /usr/share/nginx/html/
COPY --from=builder app/dist/jasper-ui ./
ARG BASE_HREF="/"
Expand Down
3 changes: 3 additions & 0 deletions docker/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ server {

gzip on;
gzip_types *;
brotli on;
brotli_types *;
brotli_static on;

#access_log /var/log/nginx/host.access.log main;

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"ng": "ng",
"start": "ng serve",
"build": "ng build --configuration production --source-map",
"postbuild": "for i in $(find dist/jasper-ui/ -type f -not -name \"*.br\" -not -name \"index.html\" -not -name \"config.json\" -print); do brotli -9 $i; done",
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should skip if brotli is not installed

"watch": "ng build --watch --configuration development",
"test": "ng test",
"e2e": "ng e2e",
Expand Down
Loading