mirror of
https://github.com/SantaSpeen/santaspeen.ru-blog.git
synced 2025-07-01 23:36:26 +00:00
add dockerfile
This commit is contained in:
parent
7fbd34be90
commit
b533e9ae56
16
Dockerfile
Normal file
16
Dockerfile
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
FROM node:latest as builder
|
||||||
|
|
||||||
|
COPY . /src
|
||||||
|
WORKDIR /src
|
||||||
|
|
||||||
|
RUN npm install
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
FROM nginx:1.24.0-alpine
|
||||||
|
WORKDIR /srv/www/
|
||||||
|
|
||||||
|
COPY nginx.conf /etc/nginx/
|
||||||
|
COPY --from=builder /src/build .
|
||||||
|
RUN chown -R nginx:nginx /srv/www
|
||||||
|
|
||||||
|
EXPOSE 8000
|
116
nginx.conf
Normal file
116
nginx.conf
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
user nginx;
|
||||||
|
worker_processes auto;
|
||||||
|
|
||||||
|
# number of file descriptors used for nginx
|
||||||
|
# the limit for the maximum FDs on the server is usually set by the OS.
|
||||||
|
# if you don't set FD's then OS settings will be used which is by default 2000
|
||||||
|
worker_rlimit_nofile 100000;
|
||||||
|
|
||||||
|
error_log /dev/stdout info;
|
||||||
|
pid /tmp/nginx.pid;
|
||||||
|
|
||||||
|
events {
|
||||||
|
# TODO: check values
|
||||||
|
worker_connections 4000;
|
||||||
|
use epoll;
|
||||||
|
multi_accept on;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
log_format json '{"remote_addr":"$remote_addr", "remote_user":"$remote_user", "time_local":"$time_local", "request":"$request", '
|
||||||
|
'"status":"$status", "body_bytes_sent":"$body_bytes_sent", "http_referer":"$http_referer", '
|
||||||
|
'"http_user_agent":"$http_user_agent", "http_x_forwarded_for":"$http_x_forwarded_for"}'; # -- POST body: $request_body
|
||||||
|
access_log /dev/stdout json;
|
||||||
|
error_log /dev/stdout error;
|
||||||
|
|
||||||
|
# cache informations about FDs, frequently accessed files
|
||||||
|
# can boost performance, but you need to test those values
|
||||||
|
open_file_cache max=200000 inactive=20s;
|
||||||
|
open_file_cache_valid 30s;
|
||||||
|
open_file_cache_min_uses 2;
|
||||||
|
open_file_cache_errors on;
|
||||||
|
|
||||||
|
send_timeout 2;
|
||||||
|
sendfile on;
|
||||||
|
tcp_nopush on;
|
||||||
|
tcp_nodelay on;
|
||||||
|
reset_timedout_connection on;
|
||||||
|
keepalive_timeout 30;
|
||||||
|
keepalive_requests 100;
|
||||||
|
client_max_body_size 100m;
|
||||||
|
client_body_timeout 120;
|
||||||
|
|
||||||
|
gzip on;
|
||||||
|
# gzip_static on;
|
||||||
|
gzip_min_length 10240;
|
||||||
|
gzip_comp_level 6;
|
||||||
|
gzip_vary on;
|
||||||
|
gzip_disable msie6;
|
||||||
|
gzip_proxied expired no-cache no-store private auth;
|
||||||
|
gzip_types
|
||||||
|
# text/html is always compressed by HttpGzipModule
|
||||||
|
text/css
|
||||||
|
text/javascript
|
||||||
|
text/xml
|
||||||
|
text/plain
|
||||||
|
text/x-component
|
||||||
|
application/javascript
|
||||||
|
application/x-javascript
|
||||||
|
application/json
|
||||||
|
application/xml
|
||||||
|
application/rss+xml
|
||||||
|
application/atom+xml
|
||||||
|
font/truetype
|
||||||
|
font/opentype
|
||||||
|
application/vnd.ms-fontobject
|
||||||
|
image/svg+xml;
|
||||||
|
|
||||||
|
client_body_temp_path /tmp/client_temp;
|
||||||
|
proxy_temp_path /tmp/proxy_temp_path;
|
||||||
|
fastcgi_temp_path /tmp/fastcgi_temp;
|
||||||
|
uwsgi_temp_path /tmp/uwsgi_temp;
|
||||||
|
scgi_temp_path /tmp/scgi_temp;
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 8000;
|
||||||
|
server_name 0.0.0.0;
|
||||||
|
|
||||||
|
# ssl_certificate $web_root/ssl/cert.crt;
|
||||||
|
# ssl_certificate_key $web_root/ssl/private.key;
|
||||||
|
# ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5;
|
||||||
|
|
||||||
|
root /srv/www;
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
# First attempt to serve request as file, then
|
||||||
|
# as directory, then fall back to redirecting to index.html
|
||||||
|
add_header Cache-Control no-cache;
|
||||||
|
expires 0;
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Media: images, icons, video, audio, HTC
|
||||||
|
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|mp3|ogg|ogv|webm|htc)$ {
|
||||||
|
expires 1M;
|
||||||
|
access_log off;
|
||||||
|
add_header Cache-Control "public";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Javascript and CSS files
|
||||||
|
location ~* \.(?:css|js)$ {
|
||||||
|
try_files $uri =404;
|
||||||
|
expires 1y;
|
||||||
|
access_log off;
|
||||||
|
add_header Cache-Control "public";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Any route containing a file extension (e.g. /devicesfile.js)
|
||||||
|
location ~ ^.+\..+$ {
|
||||||
|
try_files $uri =404;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user