File size: 1,079 Bytes
9c46160
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# DrugEnv environment Space (Docker, CPU)
# Serves both the OpenEnv FastAPI app and the Gradio demo (mounted at
# /demo by server/app.py). Listens on port 8000 (matched in README YAML
# frontmatter via app_port: 8000).
FROM python:3.11-slim

ENV PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1 \
    PYTHONPATH=/home/user/app \
    PORT=8000

RUN apt-get update && apt-get install -y --no-install-recommends \
        git curl ca-certificates build-essential \
    && rm -rf /var/lib/apt/lists/*

RUN useradd -ms /bin/bash user
USER user
ENV PATH="/home/user/.local/bin:${PATH}"
WORKDIR /home/user/app

# Copy full source first so relative -r references inside requirement
# files resolve correctly (space/env/requirements.txt does
# `-r ../../requirements.txt`, which only works when the whole tree
# is in place).
COPY --chown=user:user . /home/user/app

RUN python -m pip install --upgrade pip && \
    python -m pip install --user -r /home/user/app/space/env/requirements.txt

EXPOSE 8000

CMD ["python", "-m", "uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "8000"]