Skip to content

Commit 060c300

Browse files
committed
fix(centraldashboard): use correct public/ path
- /dist → /public/ (actual webpack output) - Copy app.bundle.js + app.css bundles - nginx.conf SPA routing preserved"
1 parent 8d08130 commit 060c300

2 files changed

Lines changed: 29 additions & 9 deletions

File tree

components/centraldashboard/Dockerfile

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,13 @@ RUN npm ci \
1616
&& npm run build \
1717
&& npm prune --production
1818

19-
# Step 2: Packages assets for serving
20-
FROM node:16.20.2-alpine AS serve
2119

22-
RUN apk add --no-cache tini
20+
# Step 2: Serve static assets with nginx (smaller, secure)
21+
FROM nginx:1.25-alpine AS serve
2322

24-
USER node
25-
26-
ENV NODE_ENV=production
27-
WORKDIR /usr/src/app
28-
COPY --from=build --chown=node:node /centraldashboard .
23+
# Copy built static assets from build stage
24+
COPY --from=build --chown=nginx:nginx /centraldashboard/public /usr/share/nginx/html
25+
COPY --from=build --chown=nginx:nginx /centraldashboard/app.bundle.js /centraldashboard/app.css /usr/share/nginx/html/
2926

3027
EXPOSE 8082
31-
ENTRYPOINT ["/sbin/tini", "--" , "npm", "start"]
28+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
server {
2+
listen 8082;
3+
server_name _;
4+
root /usr/share/nginx/html;
5+
index index.html;
6+
7+
# Static assets caching
8+
location ~ \.(js|css|png|ico)$ {
9+
expires 1y;
10+
add_header Cache-Control "public, immutable";
11+
}
12+
13+
# API proxy (keep if backend needed)
14+
location /apis/ {
15+
proxy_pass http://backend:8082/; # Or remove if not needed
16+
proxy_set_header Host $host;
17+
}
18+
19+
# SPA routing (catch all)
20+
location / {
21+
try_files $uri $uri/ /index.html;
22+
}
23+
}

0 commit comments

Comments
 (0)