Skip to content

Commit fbd2a3b

Browse files
committed
Added Dockerfile
1 parent a4ebf85 commit fbd2a3b

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

Dockerfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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

0 commit comments

Comments
 (0)