Spaces:
Running
Running
Zach Wentz
commited on
Commit
·
0f08699
1
Parent(s):
6a34cf8
🤖 Deploy openspiel_env environment - 2025-10-21 14:24:31
Browse files- Dockerfile +23 -19
- README.md +1 -0
- src/core/__pycache__/__init__.cpython-311.pyc +0 -0
- src/core/__pycache__/__init__.cpython-313.pyc +0 -0
- src/core/__pycache__/http_env_client.cpython-311.pyc +0 -0
- src/core/__pycache__/http_env_client.cpython-313.pyc +0 -0
- src/core/__pycache__/types.cpython-311.pyc +0 -0
- src/core/__pycache__/types.cpython-313.pyc +0 -0
- src/core/containers/__pycache__/__init__.cpython-311.pyc +0 -0
- src/core/containers/__pycache__/__init__.cpython-313.pyc +0 -0
- src/core/containers/runtime/__pycache__/__init__.cpython-311.pyc +0 -0
- src/core/containers/runtime/__pycache__/__init__.cpython-313.pyc +0 -0
- src/core/containers/runtime/__pycache__/providers.cpython-311.pyc +0 -0
- src/core/containers/runtime/__pycache__/providers.cpython-313.pyc +0 -0
- src/core/env_server/__pycache__/__init__.cpython-311.pyc +0 -0
- src/core/env_server/__pycache__/__init__.cpython-313.pyc +0 -0
- src/core/env_server/__pycache__/base_transforms.cpython-311.pyc +0 -0
- src/core/env_server/__pycache__/base_transforms.cpython-313.pyc +0 -0
- src/core/env_server/__pycache__/http_server.cpython-311.pyc +0 -0
- src/core/env_server/__pycache__/http_server.cpython-313.pyc +0 -0
- src/core/env_server/__pycache__/interfaces.cpython-311.pyc +0 -0
- src/core/env_server/__pycache__/interfaces.cpython-313.pyc +0 -0
- src/core/env_server/__pycache__/types.cpython-311.pyc +0 -0
- src/core/env_server/__pycache__/types.cpython-313.pyc +0 -0
- src/core/env_server/__pycache__/web_interface.cpython-311.pyc +0 -0
- src/core/env_server/__pycache__/web_interface.cpython-313.pyc +0 -0
- src/envs/openspiel_env/__pycache__/__init__.cpython-313.pyc +0 -0
- src/envs/openspiel_env/__pycache__/client.cpython-313.pyc +0 -0
- src/envs/openspiel_env/__pycache__/models.cpython-313.pyc +0 -0
- src/envs/openspiel_env/server/Dockerfile +7 -13
Dockerfile
CHANGED
|
@@ -1,16 +1,22 @@
|
|
| 1 |
-
# OpenSpiel requires complex C++ build - using
|
| 2 |
-
# Use the
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
FROM
|
| 7 |
|
| 8 |
# Avoid interactive prompts during build
|
| 9 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 10 |
ENV TZ=UTC
|
| 11 |
|
| 12 |
# Install build dependencies (curl already installed by openenv-base)
|
| 13 |
-
RUN apt-get update && apt-get install -y --no-install-recommends
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
# Set up OpenSpiel build directory
|
| 16 |
RUN mkdir /repo
|
|
@@ -27,24 +33,21 @@ RUN pip3 install --no-cache-dir --upgrade setuptools testresources importlib_met
|
|
| 27 |
RUN pip3 install --no-cache-dir --upgrade -r requirements.txt cmake
|
| 28 |
|
| 29 |
# Build OpenSpiel with Python 3.11
|
|
|
|
| 30 |
RUN mkdir -p build
|
| 31 |
WORKDIR /repo/build
|
| 32 |
-
RUN cmake -DPython3_EXECUTABLE=/usr/bin/python3 -DCMAKE_CXX_COMPILER
|
| 33 |
-
RUN make -
|
| 34 |
-
|
| 35 |
-
# Stage 2: Use the specified openenv-base image
|
| 36 |
-
FROM ${BASE_IMAGE}
|
| 37 |
|
| 38 |
-
#
|
| 39 |
-
RUN mkdir -p /repo
|
| 40 |
-
COPY --from=openspiel-builder /repo /repo
|
| 41 |
-
|
| 42 |
-
# Install OpenSpiel Python requirements in runtime
|
| 43 |
WORKDIR /repo
|
| 44 |
RUN pip3 install --no-cache-dir --upgrade -r requirements.txt
|
| 45 |
|
| 46 |
# Set Python path for OpenSpiel
|
| 47 |
-
ENV PYTHONPATH=/repo:/repo/build/python
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
# Copy OpenEnv core (base image already set WORKDIR=/app)
|
| 50 |
WORKDIR /app
|
|
@@ -66,7 +69,8 @@ ENV OPENSPIEL_AGENT_PLAYER=0
|
|
| 66 |
ENV OPENSPIEL_OPPONENT_POLICY=random
|
| 67 |
|
| 68 |
# Health check (curl is provided by openenv-base)
|
| 69 |
-
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3
|
|
|
|
| 70 |
|
| 71 |
# Note: EXPOSE 8000 already set by openenv-base
|
| 72 |
|
|
|
|
| 1 |
+
# OpenSpiel requires complex C++ build - using single-stage approach for ABI compatibility
|
| 2 |
+
# Use the standard openenv base image
|
| 3 |
+
# Built from: docker build -t openenv-base:latest -f src/core/containers/images/Dockerfile .
|
| 4 |
+
# In GitHub Actions, this is overridden to use the GHCR base image
|
| 5 |
+
ARG BASE_IMAGE=openenv-base:latest
|
| 6 |
+
FROM \${BASE_IMAGE}
|
| 7 |
|
| 8 |
# Avoid interactive prompts during build
|
| 9 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 10 |
ENV TZ=UTC
|
| 11 |
|
| 12 |
# Install build dependencies (curl already installed by openenv-base)
|
| 13 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 14 |
+
build-essential \
|
| 15 |
+
clang \
|
| 16 |
+
cmake \
|
| 17 |
+
git \
|
| 18 |
+
sudo \
|
| 19 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 20 |
|
| 21 |
# Set up OpenSpiel build directory
|
| 22 |
RUN mkdir /repo
|
|
|
|
| 33 |
RUN pip3 install --no-cache-dir --upgrade -r requirements.txt cmake
|
| 34 |
|
| 35 |
# Build OpenSpiel with Python 3.11
|
| 36 |
+
# Use the exact same Python executable as the base image
|
| 37 |
RUN mkdir -p build
|
| 38 |
WORKDIR /repo/build
|
| 39 |
+
RUN cmake -DPython3_EXECUTABLE=/usr/local/bin/python3 -DCMAKE_CXX_COMPILER=$(which clang++) ../open_spiel
|
| 40 |
+
RUN make -j$(nproc) pyspiel
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
+
# Install OpenSpiel Python requirements
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
WORKDIR /repo
|
| 44 |
RUN pip3 install --no-cache-dir --upgrade -r requirements.txt
|
| 45 |
|
| 46 |
# Set Python path for OpenSpiel
|
| 47 |
+
ENV PYTHONPATH=/repo:/repo/build/python:${PYTHONPATH}
|
| 48 |
+
|
| 49 |
+
# Test OpenSpiel import to verify ABI compatibility
|
| 50 |
+
RUN python3 -c "import pyspiel; print('OpenSpiel import successful')" || echo "OpenSpiel import failed"
|
| 51 |
|
| 52 |
# Copy OpenEnv core (base image already set WORKDIR=/app)
|
| 53 |
WORKDIR /app
|
|
|
|
| 69 |
ENV OPENSPIEL_OPPONENT_POLICY=random
|
| 70 |
|
| 71 |
# Health check (curl is provided by openenv-base)
|
| 72 |
+
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
| 73 |
+
CMD curl -f http://localhost:8000/health || exit 1
|
| 74 |
|
| 75 |
# Note: EXPOSE 8000 already set by openenv-base
|
| 76 |
|
README.md
CHANGED
|
@@ -39,6 +39,7 @@ Send a POST request to `/step` with:
|
|
| 39 |
"action_id": 1
|
| 40 |
}
|
| 41 |
}
|
|
|
|
| 42 |
|
| 43 |
## API Documentation
|
| 44 |
|
|
|
|
| 39 |
"action_id": 1
|
| 40 |
}
|
| 41 |
}
|
| 42 |
+
```
|
| 43 |
|
| 44 |
## API Documentation
|
| 45 |
|
src/core/__pycache__/__init__.cpython-311.pyc
ADDED
|
Binary file (400 Bytes). View file
|
|
|
src/core/__pycache__/__init__.cpython-313.pyc
ADDED
|
Binary file (383 Bytes). View file
|
|
|
src/core/__pycache__/http_env_client.cpython-311.pyc
ADDED
|
Binary file (7.68 kB). View file
|
|
|
src/core/__pycache__/http_env_client.cpython-313.pyc
ADDED
|
Binary file (6.93 kB). View file
|
|
|
src/core/__pycache__/types.cpython-311.pyc
ADDED
|
Binary file (1.09 kB). View file
|
|
|
src/core/__pycache__/types.cpython-313.pyc
ADDED
|
Binary file (993 Bytes). View file
|
|
|
src/core/containers/__pycache__/__init__.cpython-311.pyc
ADDED
|
Binary file (206 Bytes). View file
|
|
|
src/core/containers/__pycache__/__init__.cpython-313.pyc
ADDED
|
Binary file (224 Bytes). View file
|
|
|
src/core/containers/runtime/__pycache__/__init__.cpython-311.pyc
ADDED
|
Binary file (389 Bytes). View file
|
|
|
src/core/containers/runtime/__pycache__/__init__.cpython-313.pyc
ADDED
|
Binary file (375 Bytes). View file
|
|
|
src/core/containers/runtime/__pycache__/providers.cpython-311.pyc
ADDED
|
Binary file (10.9 kB). View file
|
|
|
src/core/containers/runtime/__pycache__/providers.cpython-313.pyc
ADDED
|
Binary file (9.64 kB). View file
|
|
|
src/core/env_server/__pycache__/__init__.cpython-311.pyc
ADDED
|
Binary file (898 Bytes). View file
|
|
|
src/core/env_server/__pycache__/__init__.cpython-313.pyc
ADDED
|
Binary file (788 Bytes). View file
|
|
|
src/core/env_server/__pycache__/base_transforms.cpython-311.pyc
ADDED
|
Binary file (1.67 kB). View file
|
|
|
src/core/env_server/__pycache__/base_transforms.cpython-313.pyc
ADDED
|
Binary file (1.57 kB). View file
|
|
|
src/core/env_server/__pycache__/http_server.cpython-311.pyc
ADDED
|
Binary file (9.2 kB). View file
|
|
|
src/core/env_server/__pycache__/http_server.cpython-313.pyc
ADDED
|
Binary file (8.33 kB). View file
|
|
|
src/core/env_server/__pycache__/interfaces.cpython-311.pyc
ADDED
|
Binary file (5.22 kB). View file
|
|
|
src/core/env_server/__pycache__/interfaces.cpython-313.pyc
ADDED
|
Binary file (4.68 kB). View file
|
|
|
src/core/env_server/__pycache__/types.cpython-311.pyc
ADDED
|
Binary file (2.39 kB). View file
|
|
|
src/core/env_server/__pycache__/types.cpython-313.pyc
ADDED
|
Binary file (2.66 kB). View file
|
|
|
src/core/env_server/__pycache__/web_interface.cpython-311.pyc
ADDED
|
Binary file (29.9 kB). View file
|
|
|
src/core/env_server/__pycache__/web_interface.cpython-313.pyc
ADDED
|
Binary file (59.3 kB). View file
|
|
|
src/envs/openspiel_env/__pycache__/__init__.cpython-313.pyc
ADDED
|
Binary file (784 Bytes). View file
|
|
|
src/envs/openspiel_env/__pycache__/client.cpython-313.pyc
ADDED
|
Binary file (4.3 kB). View file
|
|
|
src/envs/openspiel_env/__pycache__/models.cpython-313.pyc
ADDED
|
Binary file (3.41 kB). View file
|
|
|
src/envs/openspiel_env/server/Dockerfile
CHANGED
|
@@ -8,10 +8,7 @@
|
|
| 8 |
# Built from: docker build -t openenv-base:latest -f src/core/containers/images/Dockerfile .
|
| 9 |
# In GitHub Actions, this is overridden to use the GHCR base image
|
| 10 |
ARG BASE_IMAGE=openenv-base:latest
|
| 11 |
-
|
| 12 |
-
# Multi-stage build for OpenSpiel + OpenEnv
|
| 13 |
-
# Stage 1: Build OpenSpiel C++ bindings using the same base image
|
| 14 |
-
FROM ${BASE_IMAGE} AS openspiel-builder
|
| 15 |
|
| 16 |
# Avoid interactive prompts during build
|
| 17 |
ENV DEBIAN_FRONTEND=noninteractive
|
|
@@ -41,25 +38,22 @@ RUN pip3 install --no-cache-dir --upgrade setuptools testresources importlib_met
|
|
| 41 |
RUN pip3 install --no-cache-dir --upgrade -r requirements.txt cmake
|
| 42 |
|
| 43 |
# Build OpenSpiel with Python 3.11
|
|
|
|
| 44 |
RUN mkdir -p build
|
| 45 |
WORKDIR /repo/build
|
| 46 |
-
RUN cmake -DPython3_EXECUTABLE
|
| 47 |
RUN make -j$(nproc) pyspiel
|
| 48 |
|
| 49 |
-
#
|
| 50 |
-
FROM ${BASE_IMAGE}
|
| 51 |
-
|
| 52 |
-
# Copy OpenSpiel build artifacts from builder
|
| 53 |
-
RUN mkdir -p /repo
|
| 54 |
-
COPY --from=openspiel-builder /repo /repo
|
| 55 |
-
|
| 56 |
-
# Install OpenSpiel Python requirements in runtime
|
| 57 |
WORKDIR /repo
|
| 58 |
RUN pip3 install --no-cache-dir --upgrade -r requirements.txt
|
| 59 |
|
| 60 |
# Set Python path for OpenSpiel
|
| 61 |
ENV PYTHONPATH=/repo:/repo/build/python:${PYTHONPATH}
|
| 62 |
|
|
|
|
|
|
|
|
|
|
| 63 |
# Copy OpenEnv core (base image already set WORKDIR=/app)
|
| 64 |
WORKDIR /app
|
| 65 |
COPY src/core/ /app/src/core/
|
|
|
|
| 8 |
# Built from: docker build -t openenv-base:latest -f src/core/containers/images/Dockerfile .
|
| 9 |
# In GitHub Actions, this is overridden to use the GHCR base image
|
| 10 |
ARG BASE_IMAGE=openenv-base:latest
|
| 11 |
+
FROM ${BASE_IMAGE}
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
# Avoid interactive prompts during build
|
| 14 |
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
| 38 |
RUN pip3 install --no-cache-dir --upgrade -r requirements.txt cmake
|
| 39 |
|
| 40 |
# Build OpenSpiel with Python 3.11
|
| 41 |
+
# Use the exact same Python executable as the base image
|
| 42 |
RUN mkdir -p build
|
| 43 |
WORKDIR /repo/build
|
| 44 |
+
RUN cmake -DPython3_EXECUTABLE=/usr/local/bin/python3 -DCMAKE_CXX_COMPILER=$(which clang++) ../open_spiel
|
| 45 |
RUN make -j$(nproc) pyspiel
|
| 46 |
|
| 47 |
+
# Install OpenSpiel Python requirements
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
WORKDIR /repo
|
| 49 |
RUN pip3 install --no-cache-dir --upgrade -r requirements.txt
|
| 50 |
|
| 51 |
# Set Python path for OpenSpiel
|
| 52 |
ENV PYTHONPATH=/repo:/repo/build/python:${PYTHONPATH}
|
| 53 |
|
| 54 |
+
# Test OpenSpiel import to verify ABI compatibility
|
| 55 |
+
RUN python3 -c "import pyspiel; print('OpenSpiel import successful')" || echo "OpenSpiel import failed"
|
| 56 |
+
|
| 57 |
# Copy OpenEnv core (base image already set WORKDIR=/app)
|
| 58 |
WORKDIR /app
|
| 59 |
COPY src/core/ /app/src/core/
|