forked from FriendsOfShopware/shopmon
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.frontend
More file actions
52 lines (39 loc) · 1.35 KB
/
Dockerfile.frontend
File metadata and controls
52 lines (39 loc) · 1.35 KB
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
FROM node:24-alpine AS build
RUN corepack enable
COPY pnpm* /app/
COPY frontend/package.json /app/frontend/
WORKDIR /app
RUN pnpm install
COPY frontend /app/frontend
WORKDIR /app/frontend
RUN pnpm run build
FROM cgr.dev/chainguard/nginx
COPY <<EOF /etc/nginx/conf.d/nginx.default.conf
server {
listen 8080;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# Security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
# Enable gzip compression
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_types text/plain text/css text/xml text/javascript application/javascript application/xml+rss application/json application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon;
# Cache static assets
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
location / {
try_files \$uri \$uri/ /index.html;
}
}
EOF
COPY --from=build /app/frontend/dist /usr/share/nginx/html
EXPOSE 8080