File size: 958 Bytes
9eb0831
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM python:3.11-slim

# Install system dependencies and Python dependencies in one layer to reduce image size
RUN apt-get update && apt-get install -y --no-install-recommends \
    curl \
    procps \
    net-tools \
    psmisc \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Install Python dependencies FIRST to cache this layer
# Note: server/requirements.txt is copied to /tmp inside the container
COPY server/requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt && rm /tmp/requirements.txt

# Copy only the necessary code files (changing these won't invalidate the pip layer)
COPY models.py client.py __init__.py openenv.yaml /app/
COPY server/ /app/server/

# Set environment
ENV PYTHONPATH=/app
ENV PYTHONUNBUFFERED=1

# Create workspace
RUN mkdir -p /tmp/sre_tasks

# Expose the server port
EXPOSE 7860

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