github-actions[bot] commited on
Commit
5c6f32f
·
1 Parent(s): 172946b

🤖 Deploy openspiel_env environment - 2025-10-21 16:20:53

Browse files
Files changed (3) hide show
  1. Dockerfile +15 -7
  2. README.md +3 -2
  3. src/envs/openspiel_env/server/Dockerfile +14 -13
Dockerfile CHANGED
@@ -1,13 +1,14 @@
1
  # OpenSpiel requires complex C++ build - using special multi-stage approach
2
- # Stage 1: Build OpenSpiel C++ bindings
3
- FROM python:3.11 AS openspiel-builder
 
4
 
5
  # Avoid interactive prompts during build
6
  ENV DEBIAN_FRONTEND=noninteractive
7
  ENV TZ=UTC
8
 
9
- # Install build dependencies
10
- RUN apt-get update && apt-get install -y --no-install-recommends build-essential clang cmake curl git sudo && rm -rf /var/lib/apt/lists/*
11
 
12
  # Set up OpenSpiel build directory
13
  RUN mkdir /repo
@@ -43,11 +44,16 @@ RUN pip3 install --no-cache-dir --upgrade -r requirements.txt
43
  # Set Python path for OpenSpiel
44
  ENV PYTHONPATH=/repo:/repo/build/python:
45
 
46
- # Copy OpenEnv core
47
  WORKDIR /app
48
  COPY src/core/ /app/src/core/
 
 
49
  COPY src/envs/openspiel_env/ /app/src/envs/openspiel_env/
50
 
 
 
 
51
  # Extend Python path for OpenEnv (base image set PYTHONPATH=/app/src)
52
  # We prepend OpenSpiel paths
53
  ENV PYTHONPATH=/repo:/repo/build/python:/app/src
@@ -57,9 +63,11 @@ ENV OPENSPIEL_GAME=catch
57
  ENV OPENSPIEL_AGENT_PLAYER=0
58
  ENV OPENSPIEL_OPPONENT_POLICY=random
59
 
60
- # Health check
61
  HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 CMD curl -f http://localhost:8000/health || exit 1
62
 
63
- # Run the FastAPI server
 
 
64
  CMD ["uvicorn", "envs.openspiel_env.server.app:app", "--host", "0.0.0.0", "--port", "8000"]
65
  ENV ENABLE_WEB_INTERFACE=true
 
1
  # OpenSpiel requires complex C++ build - using special multi-stage approach
2
+ # Stage 1: Build OpenSpiel C++ bindings using the same base image
3
+ ARG BASE_IMAGE=openenv-base:latest
4
+ FROM AS openspiel-builder
5
 
6
  # Avoid interactive prompts during build
7
  ENV DEBIAN_FRONTEND=noninteractive
8
  ENV TZ=UTC
9
 
10
+ # Install build dependencies (curl already installed by openenv-base)
11
+ RUN apt-get update && apt-get install -y --no-install-recommends build-essential clang cmake git sudo && rm -rf /var/lib/apt/lists/*
12
 
13
  # Set up OpenSpiel build directory
14
  RUN mkdir /repo
 
44
  # Set Python path for OpenSpiel
45
  ENV PYTHONPATH=/repo:/repo/build/python:
46
 
47
+ # Copy OpenEnv core (base image already set WORKDIR=/app)
48
  WORKDIR /app
49
  COPY src/core/ /app/src/core/
50
+
51
+ # Copy OpenSpiel environment
52
  COPY src/envs/openspiel_env/ /app/src/envs/openspiel_env/
53
 
54
+ # Copy README for web interface documentation
55
+ COPY src/envs/openspiel_env/README.md /app/README.md
56
+
57
  # Extend Python path for OpenEnv (base image set PYTHONPATH=/app/src)
58
  # We prepend OpenSpiel paths
59
  ENV PYTHONPATH=/repo:/repo/build/python:/app/src
 
63
  ENV OPENSPIEL_AGENT_PLAYER=0
64
  ENV OPENSPIEL_OPPONENT_POLICY=random
65
 
66
+ # Health check (curl is provided by openenv-base)
67
  HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 CMD curl -f http://localhost:8000/health || exit 1
68
 
69
+ # Note: EXPOSE 8000 already set by openenv-base
70
+
71
+ # Run the FastAPI server (uvicorn installed by openenv-base)
72
  CMD ["uvicorn", "envs.openspiel_env.server.app:app", "--host", "0.0.0.0", "--port", "8000"]
73
  ENV ENABLE_WEB_INTERFACE=true
README.md CHANGED
@@ -35,9 +35,10 @@ Provides access to OpenSpiel games for multi-agent reinforcement learning.
35
  Send a POST request to `/step` with:
36
  ```json
37
  {
38
- "action": 0
 
 
39
  }
40
- ```
41
 
42
  ## API Documentation
43
 
 
35
  Send a POST request to `/step` with:
36
  ```json
37
  {
38
+ "action": {
39
+ "action_id": 1
40
+ }
41
  }
 
42
 
43
  ## API Documentation
44
 
src/envs/openspiel_env/server/Dockerfile CHANGED
@@ -4,21 +4,24 @@
4
  # This source code is licensed under the BSD-style license found in the
5
  # LICENSE file in the root directory of this source tree.
6
 
 
 
 
 
 
7
  # Multi-stage build for OpenSpiel + OpenEnv
8
- # Stage 1: Build OpenSpiel C++ bindings
9
- # Using Python 3.11 to match envtorch-base
10
- FROM python:3.11 AS openspiel-builder
11
 
12
  # Avoid interactive prompts during build
13
  ENV DEBIAN_FRONTEND=noninteractive
14
  ENV TZ=UTC
15
 
16
- # Install build dependencies
17
  RUN apt-get update && apt-get install -y --no-install-recommends \
18
  build-essential \
19
  clang \
20
  cmake \
21
- curl \
22
  git \
23
  sudo \
24
  && rm -rf /var/lib/apt/lists/*
@@ -43,10 +46,8 @@ WORKDIR /repo/build
43
  RUN cmake -DPython3_EXECUTABLE=$(which python3) -DCMAKE_CXX_COMPILER=$(which clang++) ../open_spiel
44
  RUN make -j$(nproc) pyspiel
45
 
46
- # Stage 2: Runtime image using published openenv-base
47
- # Uses the standardized base image from GitHub Container Registry
48
- # See: https://github.com/meta-pytorch/OpenEnv/pkgs/container/openenv-base
49
- FROM ghcr.io/meta-pytorch/openenv-base:latest
50
 
51
  # Copy OpenSpiel build artifacts from builder
52
  RUN mkdir -p /repo
@@ -78,11 +79,11 @@ ENV OPENSPIEL_GAME=catch
78
  ENV OPENSPIEL_AGENT_PLAYER=0
79
  ENV OPENSPIEL_OPPONENT_POLICY=random
80
 
81
- # Health check (curl is provided by envtorch-base)
82
  HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
83
  CMD curl -f http://localhost:8000/health || exit 1
84
 
85
- # Note: EXPOSE 8000 already set by envtorch-base
86
 
87
- # Run the FastAPI server (uvicorn installed by envtorch-base)
88
- CMD ["uvicorn", "envs.openspiel_env.server.app:app", "--host", "0.0.0.0", "--port", "8000"]
 
4
  # This source code is licensed under the BSD-style license found in the
5
  # LICENSE file in the root directory of this source tree.
6
 
7
+ # Use the standard openenv base image
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
18
  ENV TZ=UTC
19
 
20
+ # Install build dependencies (curl already installed by openenv-base)
21
  RUN apt-get update && apt-get install -y --no-install-recommends \
22
  build-essential \
23
  clang \
24
  cmake \
 
25
  git \
26
  sudo \
27
  && rm -rf /var/lib/apt/lists/*
 
46
  RUN cmake -DPython3_EXECUTABLE=$(which python3) -DCMAKE_CXX_COMPILER=$(which clang++) ../open_spiel
47
  RUN make -j$(nproc) pyspiel
48
 
49
+ # Stage 2: Use the standard openenv base image
50
+ FROM ${BASE_IMAGE}
 
 
51
 
52
  # Copy OpenSpiel build artifacts from builder
53
  RUN mkdir -p /repo
 
79
  ENV OPENSPIEL_AGENT_PLAYER=0
80
  ENV OPENSPIEL_OPPONENT_POLICY=random
81
 
82
+ # Health check (curl is provided by openenv-base)
83
  HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
84
  CMD curl -f http://localhost:8000/health || exit 1
85
 
86
+ # Note: EXPOSE 8000 already set by openenv-base
87
 
88
+ # Run the FastAPI server (uvicorn installed by openenv-base)
89
+ CMD ["uvicorn", "envs.openspiel_env.server.app:app", "--host", "0.0.0.0", "--port", "8000"]