gitdataai/docker/frontend.Dockerfile
ZhenYi 603e14e53b fix: frontend built from repo root, dist/ copied into nginx image
vite.config.ts, package.json, and src/ are at the repo root.
pnpm build outputs to dist/ at the root. COPY dist/ not apps/frontend/dist/.
2026-04-15 13:17:07 +08:00

32 lines
879 B
Docker

# Runtime only — frontend built externally via pnpm
FROM nginx:alpine
# Copy pre-built SPA assets (pnpm build outputs to dist/)
COPY dist /usr/share/nginx/html
# nginx configuration for SPA
RUN echo 'server { \
listen 80; \
server_name _; \
root /usr/share/nginx/html; \
index index.html; \
location / { \
try_files $uri $uri/ /index.html; \
} \
location /api/ { \
proxy_pass http://app:8080/api/; \
proxy_set_header Host $host; \
proxy_set_header X-Real-IP $remote_addr; \
} \
location /ws/ { \
proxy_pass http://app:8080/ws/; \
proxy_http_version 1.1; \
proxy_set_header Upgrade $http_upgrade; \
proxy_set_header Connection "upgrade"; \
proxy_set_header Host $host; \
} \
}' > /etc/nginx/conf.d/default.conf
EXPOSE 80
ENTRYPOINT ["nginx", "-g", "daemon off;"]