-
Notifications
You must be signed in to change notification settings - Fork 20
/
Dockerfile
69 lines (59 loc) · 1.52 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
FROM nginx:alpine
COPY dist /var/www/ui
COPY <<EOF /etc/nginx/conf.d/default.conf
server {
listen 80 default_server;
root /var/www;
# index index.html;
server_name brewblox;
access_log off;
# rewrite_log on;
absolute_redirect off;
sendfile on;
tcp_nopush on;
gzip on;
gzip_vary on;
gzip_types
text/plain
application/javascript
application/x-javascript
application/json
text/javascript
text/xml
text/css
image/svg+xml
font/woff
font/woff2;
location = / {
add_header used_location slash;
rewrite ^ /ui/index.html;
}
location = /ui {
add_header used_location slashui;
rewrite ^ /ui/index.html;
}
# The index file itself is small, and should not be cached
location = /ui/index.html {
expires 0;
add_header Pragma no-cache;
add_header Cache-Control "no-cache, no-store, must-revalidate, proxy-revalidate, max-age=0";
}
# No fallback to index.html for known static file types
# Static files should be aggressively cached
# We rely on hashed names for cache invalidation
location ~* ^/ui/.*\.(?:ico|css|js|svg|gif|jpe?g|png|woff2?)$ {
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
# SPA support: return index.html without redirection
location /ui/ {
try_files $uri $uri.html /ui/index.html;
}
# Static files are handled separately
# They should not use the UI index file, but are safe to be indexed
location /static/ {
autoindex on;
}
}
EOF