Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
venv
__pycache__
*.pyc
*.pyo
.env
.git
.github
node_modules
dist
build
.pytest_cache
*.log
.DS_Store
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM python:3.10-slim

WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
&& rm -rf /var/lib/apt/lists/*

# Copy requirements
COPY requirements.txt .

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy source code
COPY . .

# Install project in editable mode so climatevision module is available
RUN pip install -e .

EXPOSE 8000

# Set environment variable to ensure python output is not buffered
ENV PYTHONUNBUFFERED=1
ENV OMP_NUM_THREADS=1

# Run the FastAPI server
CMD ["uvicorn", "climatevision.api.main:app", "--host", "0.0.0.0", "--port", "8000"]
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,25 @@ pip install -r requirements.txt

## Quickstart

### Docker Compose (Recommended)

The easiest way to run the full stack is using Docker Compose:

1. Copy the environment variables:
```bash
cp .env.example .env
cp frontend/.env.example frontend/.env
```
2. Start the environment:
```bash
docker-compose up -d --build # or docker compose up -d --build
```
3. Access the application:
- Frontend: [http://localhost:5173](http://localhost:5173) (or `http://localhost:3000`)
- Backend API Docs: [http://localhost:8000/docs](http://localhost:8000/docs)

### Manual Setup

**Start the API server:**

```bash
Expand Down
33 changes: 33 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: "3.8"

services:
backend:
build:
context: .
dockerfile: Dockerfile
ports:
- "8000:8000"
volumes:
- .:/app
environment:
- PYTHONUNBUFFERED=1
env_file:
- .env
restart: unless-stopped

frontend:
build:
context: ./frontend
dockerfile: Dockerfile
ports:
- "5173:5173"
# Expose on 3000 as well in case it's overridden
- "3000:3000"
volumes:
- ./frontend:/app
- /app/node_modules
environment:
- BACKEND_URL=http://backend:8000
depends_on:
- backend
restart: unless-stopped
6 changes: 6 additions & 0 deletions frontend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
dist
build
.env
.DS_Store
*.log
17 changes: 17 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM node:18-alpine

WORKDIR /app

# Copy package files
COPY package.json package-lock.json* ./

# Install dependencies
RUN npm install

# Copy source code
COPY . .

EXPOSE 5173 3000

# Run dev server and bind to all network interfaces
CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"]
2 changes: 1 addition & 1 deletion frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default defineConfig({
strictPort: true,
proxy: {
'/api': {
target: 'http://127.0.0.1:8000',
target: process.env.BACKEND_URL || 'http://127.0.0.1:8000',
changeOrigin: true,
},
},
Expand Down