feat(docker): add web service for Vue SPA (nginx, multi-stage build)
Ports: dev=8506, demo=8507, cloud=8508 manage.sh build now includes web service
This commit is contained in:
parent
8bd1be7b16
commit
8e3eb5ef4f
6 changed files with 63 additions and 1 deletions
|
|
@ -39,6 +39,14 @@ services:
|
||||||
- "host.docker.internal:host-gateway"
|
- "host.docker.internal:host-gateway"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
|
web:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: docker/web/Dockerfile
|
||||||
|
ports:
|
||||||
|
- "8508:80"
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
searxng:
|
searxng:
|
||||||
image: searxng/searxng:latest
|
image: searxng/searxng:latest
|
||||||
volumes:
|
volumes:
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,14 @@ services:
|
||||||
- "host.docker.internal:host-gateway"
|
- "host.docker.internal:host-gateway"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
|
web:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: docker/web/Dockerfile
|
||||||
|
ports:
|
||||||
|
- "8507:80"
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
searxng:
|
searxng:
|
||||||
image: searxng/searxng:latest
|
image: searxng/searxng:latest
|
||||||
volumes:
|
volumes:
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,14 @@ services:
|
||||||
- "host.docker.internal:host-gateway"
|
- "host.docker.internal:host-gateway"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
|
web:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: docker/web/Dockerfile
|
||||||
|
ports:
|
||||||
|
- "${VUE_PORT:-8506}:80"
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
searxng:
|
searxng:
|
||||||
image: searxng/searxng:latest
|
image: searxng/searxng:latest
|
||||||
ports:
|
ports:
|
||||||
|
|
|
||||||
13
docker/web/Dockerfile
Normal file
13
docker/web/Dockerfile
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Stage 1: build
|
||||||
|
FROM node:20-alpine AS build
|
||||||
|
WORKDIR /app
|
||||||
|
COPY web/package*.json ./
|
||||||
|
RUN npm ci --prefer-offline
|
||||||
|
COPY web/ ./
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# Stage 2: serve
|
||||||
|
FROM nginx:alpine
|
||||||
|
COPY docker/web/nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
COPY --from=build /app/dist /usr/share/nginx/html
|
||||||
|
EXPOSE 80
|
||||||
18
docker/web/nginx.conf
Normal file
18
docker/web/nginx.conf
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name _;
|
||||||
|
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
# SPA fallback
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Cache static assets
|
||||||
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ {
|
||||||
|
expires 1y;
|
||||||
|
add_header Cache-Control "public, immutable";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -32,6 +32,7 @@ usage() {
|
||||||
echo -e " ${GREEN}logs [service]${NC} Tail logs (default: app)"
|
echo -e " ${GREEN}logs [service]${NC} Tail logs (default: app)"
|
||||||
echo -e " ${GREEN}update${NC} Pull latest images + rebuild app"
|
echo -e " ${GREEN}update${NC} Pull latest images + rebuild app"
|
||||||
echo -e " ${GREEN}preflight${NC} Check ports + resources; write .env"
|
echo -e " ${GREEN}preflight${NC} Check ports + resources; write .env"
|
||||||
|
echo -e " ${GREEN}models${NC} Check ollama models in config; pull any missing"
|
||||||
echo -e " ${GREEN}test${NC} Run test suite"
|
echo -e " ${GREEN}test${NC} Run test suite"
|
||||||
echo -e " ${GREEN}e2e [mode]${NC} Run E2E tests (mode: demo|cloud|local, default: demo)"
|
echo -e " ${GREEN}e2e [mode]${NC} Run E2E tests (mode: demo|cloud|local, default: demo)"
|
||||||
echo -e " Set E2E_HEADLESS=false to run headed via Xvfb"
|
echo -e " Set E2E_HEADLESS=false to run headed via Xvfb"
|
||||||
|
|
@ -91,6 +92,12 @@ case "$CMD" in
|
||||||
make preflight PROFILE="$PROFILE"
|
make preflight PROFILE="$PROFILE"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
models)
|
||||||
|
info "Checking ollama models..."
|
||||||
|
conda run -n job-seeker python scripts/preflight.py --models-only
|
||||||
|
success "Model check complete."
|
||||||
|
;;
|
||||||
|
|
||||||
start)
|
start)
|
||||||
info "Starting Peregrine (PROFILE=${PROFILE})..."
|
info "Starting Peregrine (PROFILE=${PROFILE})..."
|
||||||
make start PROFILE="$PROFILE"
|
make start PROFILE="$PROFILE"
|
||||||
|
|
@ -133,7 +140,7 @@ case "$CMD" in
|
||||||
&& echo "docker compose" \
|
&& echo "docker compose" \
|
||||||
|| (command -v podman >/dev/null 2>&1 && echo "podman compose" || echo "podman-compose"))"
|
|| (command -v podman >/dev/null 2>&1 && echo "podman compose" || echo "podman-compose"))"
|
||||||
$COMPOSE pull searxng ollama 2>/dev/null || true
|
$COMPOSE pull searxng ollama 2>/dev/null || true
|
||||||
$COMPOSE build app
|
$COMPOSE build app web
|
||||||
success "Update complete. Run './manage.sh restart' to apply."
|
success "Update complete. Run './manage.sh restart' to apply."
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue