port
This commit is contained in:
@@ -16,5 +16,8 @@ OIDC_REDIRECT_URI=http://localhost:5001/api/auth/callback
|
|||||||
# Frontend URL for callbacks
|
# Frontend URL for callbacks
|
||||||
FRONTEND_URL=http://localhost:3000
|
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)
|
# Cookie security (set to 'true' in production with HTTPS)
|
||||||
SESSION_COOKIE_SECURE=false
|
SESSION_COOKIE_SECURE=false
|
||||||
|
|||||||
10
CLAUDE.md
10
CLAUDE.md
@@ -49,7 +49,10 @@ cd frontend/frontend # Note the nested directory
|
|||||||
npm install
|
npm install
|
||||||
|
|
||||||
# Run frontend dev server (with proxy to backend)
|
# 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/)
|
# Build for production (outputs to backend/static/)
|
||||||
npm run build
|
npm run build
|
||||||
@@ -87,11 +90,14 @@ docker compose up --build
|
|||||||
# Run database migrations inside container
|
# Run database migrations inside container
|
||||||
docker compose exec backend uv run flask db migrate -m "Description"
|
docker compose exec backend uv run flask db migrate -m "Description"
|
||||||
docker compose exec backend uv run flask db upgrade
|
docker compose exec backend uv run flask db upgrade
|
||||||
|
|
||||||
|
# Use custom frontend port (defaults to 3000)
|
||||||
|
FRONTEND_PORT=4000 docker compose up
|
||||||
```
|
```
|
||||||
|
|
||||||
**Services:**
|
**Services:**
|
||||||
- Backend: http://localhost:5001 (Flask + SocketIO)
|
- 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:**
|
**Hot Reload:**
|
||||||
- Backend: Changes to `backend/`, `main.py`, and `migrations/` automatically reload Flask
|
- Backend: Changes to `backend/`, `main.py`, and `migrations/` automatically reload Flask
|
||||||
|
|||||||
@@ -11,8 +11,12 @@ RUN npm install
|
|||||||
# Copy application code
|
# Copy application code
|
||||||
COPY frontend/frontend ./
|
COPY frontend/frontend ./
|
||||||
|
|
||||||
|
# Default port (can be overridden via environment variable)
|
||||||
|
ARG PORT=3000
|
||||||
|
ENV PORT=${PORT}
|
||||||
|
|
||||||
# Expose Vite dev server 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
|
# Run dev server with host 0.0.0.0 to allow access from outside container
|
||||||
CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"]
|
CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"]
|
||||||
|
|||||||
@@ -96,8 +96,9 @@ services:
|
|||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile.frontend
|
dockerfile: Dockerfile.frontend
|
||||||
ports:
|
ports:
|
||||||
- "3000:3000"
|
- "${FRONTEND_PORT:-3000}:${FRONTEND_PORT:-3000}"
|
||||||
environment:
|
environment:
|
||||||
|
- PORT=${FRONTEND_PORT:-3000}
|
||||||
- VITE_BACKEND_URL=http://backend:5001
|
- VITE_BACKEND_URL=http://backend:5001
|
||||||
# OIDC configuration
|
# OIDC configuration
|
||||||
- VITE_OIDC_AUTHORITY=${OIDC_ISSUER}
|
- VITE_OIDC_AUTHORITY=${OIDC_ISSUER}
|
||||||
|
|||||||
@@ -4,11 +4,14 @@ import react from "@vitejs/plugin-react";
|
|||||||
// Use environment variable for backend URL, default to localhost for local dev
|
// Use environment variable for backend URL, default to localhost for local dev
|
||||||
const backendUrl = process.env.VITE_BACKEND_URL || "http://localhost:5001";
|
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/
|
// https://vite.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [react()],
|
plugins: [react()],
|
||||||
server: {
|
server: {
|
||||||
port: 3000,
|
port: frontendPort,
|
||||||
host: "0.0.0.0",
|
host: "0.0.0.0",
|
||||||
proxy: {
|
proxy: {
|
||||||
"/api": {
|
"/api": {
|
||||||
|
|||||||
Reference in New Issue
Block a user