-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
67 lines (53 loc) · 2.4 KB
/
Dockerfile
File metadata and controls
67 lines (53 loc) · 2.4 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
# =============================================================================
# GIS Data Agent — Dockerfile
# Base: GDAL/OGR with Python on Ubuntu (PROJ + GEOS included)
# =============================================================================
FROM ghcr.io/osgeo/gdal:ubuntu-small-3.9.3
LABEL maintainer="GIS Data Agent Team"
LABEL description="AI-powered geospatial analysis platform"
# Prevent interactive prompts during package install
ENV DEBIAN_FRONTEND=noninteractive
# ---- System packages --------------------------------------------------------
RUN apt-get update && apt-get install -y --no-install-recommends \
python3-pip \
python3-venv \
python3-dev \
build-essential \
libspatialindex-dev \
postgresql-client \
fonts-wqy-microhei \
fonts-noto-cjk \
libreoffice-writer \
curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# ---- Python virtual environment ---------------------------------------------
RUN python3 -m venv /app/.venv
ENV PATH="/app/.venv/bin:$PATH"
ENV VIRTUAL_ENV="/app/.venv"
# ---- Install Python dependencies -------------------------------------------
COPY requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# ---- Rebuild matplotlib font cache (pick up CJK fonts) ---------------------
RUN python -c "import matplotlib.font_manager; matplotlib.font_manager._load_fontmanager(try_read_cache=False)"
# ---- Remove build tools to save space (~200MB) ------------------------------
RUN apt-get purge -y build-essential python3-dev && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*
# ---- Copy application code --------------------------------------------------
COPY data_agent/ /app/data_agent/
COPY .chainlit/ /app/.chainlit/
COPY public/ /app/public/
COPY docker-entrypoint.sh /app/docker-entrypoint.sh
RUN chmod +x /app/docker-entrypoint.sh
# ---- Create uploads directory and non-root user -----------------------------
RUN groupadd -r agent && useradd -r -g agent -d /app -s /bin/bash agent && \
mkdir -p /app/data_agent/uploads && \
chown -R agent:agent /app
USER agent
# ---- Runtime configuration --------------------------------------------------
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:${PORT:-8080}/ || exit 1
ENTRYPOINT ["/app/docker-entrypoint.sh"]