File size: 1,713 Bytes
81aa69d
 
 
7b09dd1
81aa69d
7b09dd1
 
 
81aa69d
 
cd189b9
81aa69d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45e91a8
7b09dd1
 
81aa69d
7b09dd1
 
 
45e91a8
81aa69d
7b09dd1
 
 
 
 
45e91a8
40b0e9f
81aa69d
 
45e91a8
40b0e9f
81aa69d
40b0e9f
 
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
# ──────────────────────────────────────────────────────────────
# Customer Support Environment β€” Dockerfile
# Compatible with HuggingFace Spaces (Docker SDK).
# HF Spaces expects port 7860 and a non-root user.
#
# Local usage:
#   docker build -t customer-support-env .
#   docker run -p 7860:7860 customer-support-env
# ──────────────────────────────────────────────────────────────

FROM python:3.10-slim

# Prevent Python from writing .pyc files and enable stdout/stderr buffering
ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1

WORKDIR /app

# Install system dependencies (minimal)
RUN apt-get update && \
    apt-get install -y --no-install-recommends curl && \
    rm -rf /var/lib/apt/lists/*

# Copy requirements first for Docker layer caching
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir -r requirements.txt

# Create a non-root user (required by HF Spaces)t
RUN useradd -m -u 1000 user
USER user

# Set environment
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH \
    PYTHONPATH="/app"

WORKDIR /app

# Copy application code (as non-root user)
COPY --chown=user:user . .

# Expose port (local default matching README)
EXPOSE 7860

# Health check
HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=3 \
    CMD curl -f http://localhost:7860/health || exit 1

# Run server on port 7860
CMD ["uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "7860"]