-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile
More file actions
67 lines (56 loc) · 2.35 KB
/
Dockerfile
File metadata and controls
67 lines (56 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# ============================================================================
# Eurus ERA5 Agent — Docker Image
# ============================================================================
# Multi-target build:
# docker build --target agent -t eurus-agent .
# docker build --target web -t eurus-web .
#
# Or use docker-compose (preferred):
# docker compose run --rm agent # interactive CLI
# docker compose up web # FastAPI on :8000
# ============================================================================
# ---------- base ----------
FROM python:3.12-slim AS base
# System deps for scientific stack (numpy/scipy wheels, geopandas/shapely, matplotlib)
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc g++ \
libgeos-dev \
libproj-dev \
libffi-dev \
curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install Python deps first (layer caching)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy project source
COPY pyproject.toml .
COPY src/ src/
COPY main.py .
COPY web/ web/
COPY tests/ tests/
COPY scripts/ scripts/
COPY assets/ assets/
COPY README.md LICENSE ./
# Install eurus package in editable mode
RUN pip install --no-cache-dir -e ".[agent,web]"
# Create dirs the agent expects
RUN mkdir -p /app/data/plots /app/.memory /app/logs
# Pre-download Natural Earth data for Cartopy coastlines
RUN python -c "import cartopy; cartopy.io.shapereader.natural_earth(resolution='110m', category='physical', name='coastline')" \
&& python -c "import cartopy; cartopy.io.shapereader.natural_earth(resolution='50m', category='physical', name='coastline')" \
&& python -c "import cartopy; cartopy.io.shapereader.natural_earth(resolution='110m', category='physical', name='land')" \
&& python -c "import cartopy; cartopy.io.shapereader.natural_earth(resolution='50m', category='physical', name='land')"
# Signal to the REPL that we're inside Docker → security checks disabled
ENV EURUS_DOCKER=1
# Matplotlib: no GUI backend
ENV MPLBACKEND=Agg
# Ensure Python output is unbuffered (for docker logs)
ENV PYTHONUNBUFFERED=1
# ---------- agent (CLI mode) ----------
FROM base AS agent
ENTRYPOINT ["python", "main.py"]
# ---------- web (FastAPI mode) ----------
FROM base AS web
EXPOSE 7860
CMD ["uvicorn", "web.app:app", "--host", "0.0.0.0", "--port", "7860"]