|
1 | | -FROM python:3.7-buster |
| 1 | +FROM python:3.9-slim |
2 | 2 |
|
3 | 3 | ARG BUILD_ENV |
4 | 4 | ARG OVERCOOKED_BRANCH |
5 | 5 | ARG GRAPHICS |
6 | 6 |
|
7 | 7 | WORKDIR /app |
8 | 8 |
|
9 | | -# Install non-chai dependencies |
10 | | -COPY ./requirements.txt ./requirements.txt |
11 | | -RUN pip install -r requirements.txt |
| 9 | +# Install uv |
| 10 | +RUN pip install uv |
12 | 11 |
|
13 | | -# Install eventlet production server if production build |
14 | | -RUN if [ "$BUILD_ENV" = "production" ] ; then pip install eventlet ; fi |
| 12 | +# Create a virtual environment for uv |
| 13 | +RUN uv venv |
| 14 | + |
| 15 | +# Copy the pyproject.toml for installation |
| 16 | +COPY ./pyproject.toml ./pyproject.toml |
| 17 | +COPY ./dev_helper.py ./dev_helper.py |
15 | 18 |
|
16 | | -# Clone chai code |
| 19 | +# Clone chai code for the human_aware_rl module |
| 20 | +RUN apt-get update && apt-get install -y git |
17 | 21 | RUN git clone --recursive https://github.com/HumanCompatibleAI/overcooked_ai.git --branch $OVERCOOKED_BRANCH --single-branch /overcooked_ai |
18 | 22 |
|
19 | 23 | # Dummy data_dir so things don't break |
20 | 24 | RUN echo "import os; DATA_DIR=os.path.abspath('.')" >> /overcooked_ai/src/human_aware_rl/data_dir.py |
21 | 25 |
|
22 | | -# Install chai dependencies |
23 | | -RUN pip install -e '/overcooked_ai[harl]' |
| 26 | +# Install server dependencies |
| 27 | +RUN . .venv/bin/activate && uv pip install -e . |
24 | 28 |
|
25 | | -RUN apt-get -y update |
26 | | -RUN apt-get install -y libgl1-mesa-dev |
| 29 | +# Install the cloned overcooked_ai in development mode |
| 30 | +RUN . .venv/bin/activate && uv pip install -e /overcooked_ai |
| 31 | + |
| 32 | +# Install eventlet production server if production build |
| 33 | +RUN if [ "$BUILD_ENV" = "production" ] ; then . .venv/bin/activate && uv pip install "eventlet>=0.39.0" ; fi |
| 34 | + |
| 35 | +# Install needed packages |
| 36 | +RUN apt-get update && apt-get install -y \ |
| 37 | + libgl1-mesa-dev \ |
| 38 | + && rm -rf /var/lib/apt/lists/* |
27 | 39 |
|
28 | 40 | # Copy over remaining files |
29 | 41 | COPY ./static ./static |
30 | 42 | COPY ./*.py ./ |
31 | 43 | COPY ./graphics/$GRAPHICS ./static/js/graphics.js |
32 | 44 | COPY ./config.json ./config.json |
33 | 45 |
|
34 | | - |
35 | | - |
36 | 46 | # Set environment variables that will be used by app.py |
37 | 47 | ENV HOST 0.0.0.0 |
38 | 48 | ENV PORT 5000 |
39 | 49 | ENV CONF_PATH config.json |
40 | 50 |
|
41 | | -# Do the thing |
| 51 | +# Expose port and run the app, using dev_helper to ensure proper Python path |
42 | 52 | EXPOSE 5000 |
43 | | -CMD ["python", "-u", "app.py"] |
| 53 | +CMD [".venv/bin/python", "-m", "dev_helper", "app.py"] |
0 commit comments