Enhance web server

This commit is contained in:
schmelczerandras 2020-07-16 17:18:42 +02:00
parent 0390c74061
commit 7c68deef24
3 changed files with 79 additions and 4 deletions

View file

@ -1,5 +1,5 @@
Dockerfile
node_modules node_modules
dist dist
target
package-lock.json package-lock.json
.* .*

View file

@ -1,9 +1,30 @@
FROM node:latest as build FROM python:3.8-alpine as build-error-pages
WORKDIR /home/python
COPY error-pages .
RUN python build.py
FROM node:latest as build-webpage
WORKDIR /home/node WORKDIR /home/node
COPY . .
COPY src src
COPY static static
COPY package.json custom.d.ts tsconfig.json webpack.config.js ./
RUN npm install RUN npm install
RUN npm run build RUN npm run build
FROM nginx:alpine FROM nginx:alpine
COPY --from=build /home/node/dist/ /usr/share/nginx/html
WORKDIR /usr/share/nginx/html
RUN rm -rf *
COPY --from=build-webpage /home/node/dist .
COPY --from=build-error-pages /home/python/built errors
RUN find . -type f | xargs gzip -k9 &&\
chmod -R 555 .
COPY nginx-config /etc/nginx/

View file

@ -0,0 +1,54 @@
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
sendfile_max_chunk 1m;
tcp_nopush on;
keepalive_timeout 65;
gzip on;
gzip_static on;
gzip_vary on;
gzip_min_length 10240;
gzip_proxied any;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
location ~* \.(jpg|jpeg|png|ico)$ {
expires 30d;
}
error_page 403 /403.html;
error_page 404 /404.html;
error_page 500 501 502 503 504 /50x.html;
location ~ ^/(403|404|50x).html$ {
root /usr/share/nginx/html/errors;
internal;
}
}
}