Skip to content

Commit 87eba5d

Browse files
committed
feat: Update Dockerfile to use nginx:stable-alpine and add custom nginx configuration
1 parent 6c30fb1 commit 87eba5d

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

Dockerfile

+8-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@ RUN pnpm fetch
1313
COPY . /app
1414
RUN pnpm run build
1515

16-
FROM steebchen/nginx-spa:stable
16+
FROM nginx:stable-alpine
17+
18+
RUN sed -i '1idaemon off;' /etc/nginx/nginx.conf
19+
20+
COPY nginx.conf /etc/nginx/conf.d/default.conf
21+
1722
COPY --from=prod /app/dist/ /app
23+
1824
EXPOSE 80
25+
1926
CMD [ "nginx" ]

nginx.conf

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
server {
2+
listen 80 default_server;
3+
4+
gzip on;
5+
gzip_min_length 1000;
6+
gzip_types text/plain text/xml application/javascript text/css;
7+
8+
root /app;
9+
10+
# normal routes
11+
# serve given url and default to index.html if not found
12+
# e.g. /, /user and /foo/bar will return index.html
13+
location / {
14+
add_header Cache-Control "no-store";
15+
try_files $uri $uri/index.html /index.html;
16+
}
17+
18+
# files
19+
# for all routes matching a dot, check for files and return 404 if not found
20+
# e.g. /file.js returns a 404 if not found
21+
location ~ \.(?!html) {
22+
add_header Cache-Control "public, max-age=2678400";
23+
try_files $uri =404;
24+
}
25+
}

0 commit comments

Comments
 (0)