This commit is contained in:
2026-01-12 21:13:21 -05:00
parent 557f440256
commit 444dbe4458
5 changed files with 22 additions and 5 deletions

View File

@@ -16,5 +16,8 @@ OIDC_REDIRECT_URI=http://localhost:5001/api/auth/callback
# Frontend URL for callbacks
FRONTEND_URL=http://localhost:3000
# Frontend port (defaults to 3000 if not set)
# FRONTEND_PORT=3000
# Cookie security (set to 'true' in production with HTTPS)
SESSION_COOKIE_SECURE=false

View File

@@ -49,7 +49,10 @@ cd frontend/frontend # Note the nested directory
npm install
# Run frontend dev server (with proxy to backend)
npm run dev # Runs on port 3000
npm run dev # Runs on port 3000 by default
# Run on custom port
PORT=4000 npm run dev
# Build for production (outputs to backend/static/)
npm run build
@@ -87,11 +90,14 @@ docker compose up --build
# Run database migrations inside container
docker compose exec backend uv run flask db migrate -m "Description"
docker compose exec backend uv run flask db upgrade
# Use custom frontend port (defaults to 3000)
FRONTEND_PORT=4000 docker compose up
```
**Services:**
- Backend: http://localhost:5001 (Flask + SocketIO)
- Frontend: http://localhost:3000 (Vite dev server)
- Frontend: http://localhost:3000 (Vite dev server, configurable via `FRONTEND_PORT` env var)
**Hot Reload:**
- Backend: Changes to `backend/`, `main.py`, and `migrations/` automatically reload Flask

View File

@@ -11,8 +11,12 @@ RUN npm install
# Copy application code
COPY frontend/frontend ./
# Default port (can be overridden via environment variable)
ARG PORT=3000
ENV PORT=${PORT}
# Expose Vite dev server port
EXPOSE 3000
EXPOSE ${PORT}
# Run dev server with host 0.0.0.0 to allow access from outside container
CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"]

View File

@@ -96,8 +96,9 @@ services:
context: .
dockerfile: Dockerfile.frontend
ports:
- "3000:3000"
- "${FRONTEND_PORT:-3000}:${FRONTEND_PORT:-3000}"
environment:
- PORT=${FRONTEND_PORT:-3000}
- VITE_BACKEND_URL=http://backend:5001
# OIDC configuration
- VITE_OIDC_AUTHORITY=${OIDC_ISSUER}

View File

@@ -4,11 +4,14 @@ import react from "@vitejs/plugin-react";
// Use environment variable for backend URL, default to localhost for local dev
const backendUrl = process.env.VITE_BACKEND_URL || "http://localhost:5001";
// Use environment variable for frontend port, default to 3000
const frontendPort = parseInt(process.env.PORT || process.env.VITE_PORT || "3000", 10);
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
server: {
port: 3000,
port: frontendPort,
host: "0.0.0.0",
proxy: {
"/api": {