fix: use docker compose watch under dev
All checks were successful
Deploy to Production / deploy (push) Successful in 1m12s

This commit is contained in:
魏风
2026-03-25 09:42:57 +08:00
parent 89c13e8cad
commit 4caf19fcc0
3 changed files with 44 additions and 4 deletions

7
.env
View File

@@ -43,3 +43,10 @@ SENTRY_DSN=
# Configure these with your own Docker registry images
DOCKER_IMAGE_BACKEND=backend
DOCKER_IMAGE_FRONTEND=frontend
# MQTT Config
MQTT_HOST=101.35.119.226
MQTT_PORT=1883
MQTT_USERNAME=weefnn
MQTT_PASSWORD=123456
MQTT_CLIENT_ID=spatialhub-local-dev-weifeng

View File

@@ -114,9 +114,31 @@ services:
build:
context: .
dockerfile: frontend/Dockerfile
target: dev-stage
args:
- VITE_API_URL=http://localhost:8000
- NODE_ENV=development
environment:
- VITE_API_URL=http://localhost:8000
- CHOKIDAR_USEPOLLING=true
- CHOKIDAR_INTERVAL=150
develop:
watch:
- path: ./frontend
action: sync
target: /app/frontend
ignore:
- node_modules/
- dist/
- blob-report/
- test-results/
- package.json
- path: ./frontend/package.json
action: rebuild
- path: ./package.json
action: rebuild
- path: ./bun.lock
action: rebuild
playwright:
build:

View File

@@ -1,10 +1,9 @@
# Stage 0, "build-stage", based on Bun, to build and compile the frontend
FROM oven/bun:1 AS build-stage
# Shared Bun stage for frontend dependencies and sources
FROM oven/bun:1 AS bun-base
WORKDIR /app
COPY package.json bun.lock /app/
COPY frontend/package.json /app/frontend/
WORKDIR /app/frontend
@@ -14,10 +13,22 @@ RUN bun install
COPY ./frontend /app/frontend
ARG VITE_API_URL
# Development stage for docker compose watch + Vite HMR
FROM bun-base AS dev-stage
EXPOSE 80
CMD ["bun", "run", "dev", "--host", "0.0.0.0", "--port", "80"]
# Build stage for production assets
FROM bun-base AS build-stage
RUN bun run build
# Stage 1, based on Nginx, to have only the compiled app, ready for production with Nginx
# Production stage serving compiled assets with Nginx
FROM nginx:1
COPY --from=build-stage /app/frontend/dist/ /usr/share/nginx/html