Move static files to proxy container

Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
Fred Boniface 2023-01-19 00:40:36 +00:00
parent fa1597855c
commit 94063af0e4
6 changed files with 27 additions and 10 deletions

View File

@ -8,3 +8,4 @@ nginx-proxy-docker
README.md
LICENSE
UpNext.md
static

View File

@ -2,6 +2,6 @@ FROM node:19
EXPOSE 8460
WORKDIR /usr/src/app
COPY ./package*.json ./
RUN npm ci --only=production
RUN npm ci --omit=dev
COPY . .
CMD [ "node", "app.js" ]

View File

@ -1,3 +0,0 @@
FROM nginx:mainline-alpine-slim
RUN rm /etc/nginx/nginx.conf
COPY ./nginx.conf /etc/nginx/nginx.conf

2
static/.dockerignore Normal file
View File

@ -0,0 +1,2 @@
.dockerignore
Dockerfile

18
static/Dockerfile Normal file
View File

@ -0,0 +1,18 @@
FROM fedora:latest as compressor
RUN dnf install brotli -y
COPY . /data/
RUN rm -r /data/nginx
#RUN brotli -q 9 /data/*.json
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/

View File

@ -1,5 +1,5 @@
user nginx;
worker_processes auto;
worker_processes 1;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
@ -29,10 +29,9 @@ http {
proxy_cache owl_cache;
location / {
proxy_pass http://localhost:8460;
proxy_cache_key $scheme://$host$uri$is_args$query_string;
proxy_ignore_headers Cache-Control;
proxy_cache_valid 200 10080m;
root /site-static/;
index index.html;
gzip_static on;
}
location /api/ {