File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ # ---------- build stage ----------
2+ FROM node:20-alpine AS build
3+ WORKDIR /app
4+
5+ COPY package*.json ./
6+ RUN npm ci --no-audit
7+
8+ COPY . .
9+ # build the app
10+ RUN npm run build
11+
12+ # normalize output dir to /app/out (supports Vite 'dist' or CRA 'build')
13+ RUN set -eux; \
14+ if [ -d dist ]; then \
15+ cp -r dist out; \
16+ elif [ -d build ]; then \
17+ cp -r build out; \
18+ else \
19+ echo "ERROR: No build output dir found (looked for 'dist' and 'build')." ; \
20+ echo "Listing /app after build:" ; ls -la; \
21+ exit 1; \
22+ fi; \
23+ ls -la out
24+
25+ # ---------- runtime stage ----------
26+ FROM nginx:1.27-alpine
27+ # nginx config (we already created frontend/docker/nginx.conf earlier)
28+ COPY docker/nginx.conf /etc/nginx/nginx.conf
29+ # built static assets
30+ COPY --from=build /app/out /usr/share/nginx/html
You can’t perform that action at this time.
0 commit comments