File size: 2,158 Bytes
644bdfe
 
a1be2d1
644bdfe
9c1e1f6
 
 
a1be2d1
644bdfe
9c1e1f6
 
 
 
bedc715
a1be2d1
 
644bdfe
74cc69f
9c1e1f6
bedc715
a1be2d1
 
bedc715
a1be2d1
9c1e1f6
9123b55
 
a1be2d1
bedc715
9c1e1f6
 
 
 
644bdfe
a1be2d1
9b88aa8
a1be2d1
 
 
 
 
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
FROM python:3.10-slim

# ── Base OS packages ────────────────────────────────────────────────
RUN apt-get update && apt-get install -y --no-install-recommends \
    gcc python3-dev openssl curl ca-certificates gnupg build-essential \
    && rm -rf /var/lib/apt/lists/*

# ── MariaDB client libs ─────────────────────────────────────────────
RUN curl -LsSO https://r.mariadb.com/downloads/mariadb_repo_setup && \
    chmod +x mariadb_repo_setup && ./mariadb_repo_setup --mariadb-server-version="mariadb-11.7" && \
    apt-get update && apt-get install -y --no-install-recommends \
    libmariadb3 libmariadb-dev && \
    apt-get clean && rm -rf /var/lib/apt/lists/*

# ── Python tooling ─────────────────────────────────────────────────
RUN pip install --no-cache-dir uv==0.1.37   # pin to avoid future breakage

WORKDIR /app
COPY . /app

# Install your project + FastMCP server dependencies
RUN uv pip install -e .[server] --system

# ── Create unprivileged runtime user ───────────────────────────────
RUN useradd -m -u 1000 user
USER user

# ── Environment ────────────────────────────────────────────────────
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH \
    UV_NO_CACHE=1 \
    UV_CACHE_DIR=/dev/null \
    PORT=7860

# ── Expose and health-check ────────────────────────────────────────
EXPOSE 7860
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s \
  CMD curl -f http://localhost:7860/ || exit 1

# ── Launch wrapper app (app.py) instead of CLI ─────────────────────
CMD uvicorn app:app --host 0.0.0.0 --port $PORT --workers 1