From efb202577e81a1357c5904e6a2c15c7aeb83c571 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Thu, 19 Jan 2023 01:19:45 +0000 Subject: [PATCH] Notes Signed-off-by: Fred Boniface --- UpNext.md | 3 ++- static/Dockerfile | 8 ++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/UpNext.md b/UpNext.md index 47762f5..7307077 100644 --- a/UpNext.md +++ b/UpNext.md @@ -8,4 +8,5 @@ * Frontend - If Ferry Services Present - Load at bottom of screen. * Frontend - Decide what to do with Bus Services. * Frontend - Implement error pages - will need to look at including these on the proxy container too? - - https://expressjs.com/en/guide/error-handling.html \ No newline at end of file + - https://expressjs.com/en/guide/error-handling.html +* Building - Implement build process in dockerfile that minifies and then compresses the static source. \ No newline at end of file diff --git a/static/Dockerfile b/static/Dockerfile index 7175c57..1dccec4 100644 --- a/static/Dockerfile +++ b/static/Dockerfile @@ -1,18 +1,14 @@ FROM fedora:latest as compressor -RUN dnf install brotli -y +RUN dnf install brotli nodejs npm -y && npm i uglify-js -g COPY . /data/ RUN rm -r /data/nginx -#RUN brotli -q 9 /data/*.json +RUN uglifyjs /data/js/*.js --compress --mangle RUN gzip -k -9 /data/*.json -#RUN brotli -q 9 /data/styles/*.css RUN gzip -k -9 /data/styles/*.css -#RUN brotli -q 9 /data/js/*.js RUN gzip -k -9 /data/js/*.js -#RUN brotli -q 9 /data/*.html RUN gzip -k -9 /data/*.html FROM nginx:mainline-alpine-slim -#RUN apk add nginx-mod-http-brotli RUN rm /etc/nginx/nginx.conf COPY ./nginx/nginx.conf /etc/nginx/nginx.conf COPY --from=compressor /data/ /site-static/ \ No newline at end of file