File size: 1,068 Bytes
6ca77a7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# MedCodeRL — Root Dockerfile for HF Spaces & OpenEnv validation
#
# Build:  docker build -t medcoderl .
# Run:    docker run -p 7680:7680 medcoderl

FROM python:3.11-slim

WORKDIR /app

# Ensure stdout/stderr are unbuffered for real-time logging
ENV PYTHONUNBUFFERED=1

# System deps
RUN apt-get update && \
    apt-get install -y --no-install-recommends curl git && \
    rm -rf /var/lib/apt/lists/*

# Install Python dependencies (root requirements first for layer caching)
COPY requirements.txt /app/requirements.txt
COPY server/requirements.txt /app/server_requirements.txt
RUN pip install --no-cache-dir -r /app/requirements.txt && \
    pip install --no-cache-dir -r /app/server_requirements.txt

# Copy all source code
COPY . /app/

# Ensure the package is importable
ENV PYTHONPATH="/app:$PYTHONPATH"

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

EXPOSE 7680

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