Skip to content

Commit e90e7f7

Browse files
committed
chore: docker nginx spa
1 parent 0e8120a commit e90e7f7

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ FROM nginx:1.27.4-alpine@sha256:4ff102c5d78d254a6f0da062b3cf39eaf07f01eec0927fd2
1515

1616
COPY --from=builder /app/dist /usr/share/nginx/html
1717

18+
COPY docker/nginx/snippets/proxy-params.conf /etc/nginx/snippets/proxy-params.conf
19+
# each time nginx is started it will perform variable substition in all template
20+
# files found in `/etc/nginx/templates/*.template`, and copy the results (without
21+
# the `.template` suffix) into `/etc/nginx/conf.d/`.
22+
COPY docker/nginx/templates/default.conf.template /etc/nginx/templates/default.conf.template
23+
1824
EXPOSE 80
1925

2026
CMD ["nginx", "-g", "daemon off;"]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
proxy_redirect off;
2+
proxy_set_header Host $http_host;
3+
proxy_set_header X-Real-IP $remote_addr;
4+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
5+
proxy_set_header X-Forwarded-Proto http;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
server {
3+
listen 80;
4+
listen [::]:80;
5+
6+
root /usr/share/nginx/html;
7+
index index.html;
8+
9+
gzip on;
10+
gzip_types text/plain text/xml text/css application/javascript application/json image/svg+xml;
11+
12+
location / {
13+
include /etc/nginx/snippets/proxy-params.conf;
14+
15+
try_files $uri $uri/ $uri.html /index.html;
16+
add_header Cache-Control "no-store";
17+
}
18+
19+
location ~* \.(?:css|js|jpg|svg|png)$ {
20+
expires 30d;
21+
add_header Cache-Control "public";
22+
}
23+
24+
location ~* \.(?:json)$ {
25+
expires 1d;
26+
add_header Cache-Control "public";
27+
}
28+
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"preview": "vite preview",
1212
"format": "prettier --write --no-error-on-unmatched-pattern 'src/**/*.{ts,tsx,json,css,md}'",
1313
"docker:build": "docker build --tag wildcat-dashboard-ui .",
14+
"docker:rebuild": "npm run docker:build -- --no-cache",
1415
"docker:up": "docker compose up"
1516
},
1617
"dependencies": {

0 commit comments

Comments
 (0)