Compare commits
2 Commits
86f6e4f81c
...
2c7d5ea589
| Author | SHA1 | Date | |
|---|---|---|---|
| 2c7d5ea589 | |||
| 36e3b40936 |
@@ -60,6 +60,16 @@ services:
|
|||||||
retries: 3
|
retries: 3
|
||||||
start_period: 40s
|
start_period: 40s
|
||||||
|
|
||||||
|
# Frontend build service
|
||||||
|
frontend:
|
||||||
|
build:
|
||||||
|
context: ../frontend
|
||||||
|
dockerfile: ../docker/Dockerfile.frontend
|
||||||
|
volumes:
|
||||||
|
- ../frontend/dist:/app/dist
|
||||||
|
networks:
|
||||||
|
- app-network
|
||||||
|
|
||||||
# Nginx for serving frontend (optional - can also serve via FastAPI)
|
# Nginx for serving frontend (optional - can also serve via FastAPI)
|
||||||
nginx:
|
nginx:
|
||||||
image: nginx:alpine
|
image: nginx:alpine
|
||||||
@@ -72,7 +82,10 @@ services:
|
|||||||
- ../nginx.conf:/etc/nginx/nginx.conf:ro
|
- ../nginx.conf:/etc/nginx/nginx.conf:ro
|
||||||
- ../frontend/dist:/usr/share/nginx/html:ro
|
- ../frontend/dist:/usr/share/nginx/html:ro
|
||||||
depends_on:
|
depends_on:
|
||||||
- backend
|
frontend:
|
||||||
|
condition: service_completed_successfully
|
||||||
|
backend:
|
||||||
|
condition: service_started
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ POSTGRES_PORT=5432
|
|||||||
BACKEND_PORT=8500
|
BACKEND_PORT=8500
|
||||||
|
|
||||||
# Frontend Configuration
|
# Frontend Configuration
|
||||||
FRONTEND_PORT=80
|
FRONTEND_PORT=8080
|
||||||
|
|
||||||
# Database Connection String (used by backend)
|
# Database Connection String (used by backend)
|
||||||
CONN_STR=postgresql://myapp_user:secure_password_123@postgres:5432/ai_conversations
|
CONN_STR=postgresql://myapp_user:secure_password_123@postgres:5432/ai_conversations
|
||||||
@@ -61,6 +61,21 @@ EOF
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Build frontend
|
||||||
|
build_frontend() {
|
||||||
|
echo -e "${YELLOW}Building frontend...${NC}"
|
||||||
|
cd "$PROJECT_ROOT/frontend"
|
||||||
|
|
||||||
|
if [ ! -d "node_modules" ]; then
|
||||||
|
echo "Installing frontend dependencies..."
|
||||||
|
npm install
|
||||||
|
fi
|
||||||
|
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
echo -e "${GREEN}✓ Frontend built successfully${NC}\n"
|
||||||
|
}
|
||||||
|
|
||||||
# Build Docker images
|
# Build Docker images
|
||||||
build_images() {
|
build_images() {
|
||||||
echo -e "${YELLOW}Building Docker images...${NC}"
|
echo -e "${YELLOW}Building Docker images...${NC}"
|
||||||
@@ -137,6 +152,7 @@ show_status() {
|
|||||||
main() {
|
main() {
|
||||||
check_requirements
|
check_requirements
|
||||||
create_env_file
|
create_env_file
|
||||||
|
build_frontend
|
||||||
build_images
|
build_images
|
||||||
start_services
|
start_services
|
||||||
init_database
|
init_database
|
||||||
|
|||||||
Reference in New Issue
Block a user