Skip to content

Commit

Permalink
Precompressed NGINX build
Browse files Browse the repository at this point in the history
  • Loading branch information
wayfarer3130 committed Dec 8, 2024
1 parent 521ff45 commit 7c5d022
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .docker/Viewer-v3.x/default.conf.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
server {
gzip_static always;
gzip_proxied expired no-cache no-store private auth;
gunzip on;
listen ${PORT} default_server;
listen [::]:${PORT} default_server;
location / {
Expand Down
1 change: 1 addition & 0 deletions .docker/compressDist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
find platform/app/dist -name "*.js" -exec gzip -9 "{}" \; -exec touch "{}" \;
10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,23 @@ COPY --parents ./addOns/package.json ./addOns/*/*/package.json ./extensions/*/pa
# Run the install before copying the rest of the files
RUN yarn install
# Copy the local directory
COPY --link --exclude=node_modules --exclude=yarn.lock --exclude=package.json . .
COPY --link --exclude=node_modules --exclude=yarn.lock --exclude=package.json --exclude=Dockerfile . .
# Do a second install to finalize things after the copy
RUN yarn install

# Build here
# After install it should hopefully be stable until the local directory changes
ENV QUICK_BUILD true
# ENV GENERATE_SOURCEMAP=false
ENV REACT_APP_CONFIG=config/default.js
ARG REACT_APP_CONFIG=config/default.js
ARG PUBLIC_URL

RUN yarn run build

# Precompress files
RUN chmod u+x .docker/compressDist.sh
RUN ./.docker/compressDist.sh

# Stage 3: Bundle the built application into a Docker container
# which runs Nginx using Alpine Linux
FROM nginxinc/nginx-unprivileged:1.25-alpine as final
Expand Down

0 comments on commit 7c5d022

Please sign in to comment.