-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
75 lines (66 loc) 路 1.4 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
FROM node:12-alpine as build
WORKDIR /app
RUN apk add --no-cache git
COPY package.json yarn.lock ./
RUN yarn install --only=prod
COPY . .
RUN yarn build
FROM nginx:alpine
RUN echo $'\
worker_processes auto;\
worker_rlimit_nofile 65535;\
\
events {\
multi_accept on;\
worker_connections 65535;\
}\
\
http {\
charset utf-8;\
sendfile on;\
tcp_nopush on;\
tcp_nodelay on;\
server_tokens off;\
log_not_found off;\
types_hash_max_size 2048;\
client_max_body_size 16M;\
\
# MIME\
include mime.types;\
default_type application/octet-stream;\
\
server {\
listen 80;\
listen [::]:80;\
root /usr/share/nginx/html;\
\
# . files\
location ~ /\.(?!well-known) {\
deny all;\
}\
\
# index.html fallback\
location / {\
try_files $uri $uri/ /index.html;\
}\
\
# assets, media\
location ~* \.(?:css(\.map)?|js(\.map)?|jpe?g|png|gif|ico|cur|heic|webp|tiff?|mp3|m4a|aac|ogg|midi?|wav|mp4|mov|webm|mpe?g|avi|ogv|flv|wmv)$ {\
expires 7d;\
}\
\
# svg, fonts\
location ~* \.(?:svgz?|ttf|ttc|otf|eot|woff2?)$ {\
add_header Access-Control-Allow-Origin "*";\
expires 7d;\
}\
\
# gzip\
gzip on;\
gzip_vary on;\
gzip_proxied any;\
gzip_comp_level 6;\
gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml;\
}\
}' > /etc/nginx/nginx.conf
COPY --from=build /app/build /usr/share/nginx/html