Zach Wentz commited on
Commit
dfbefbe
·
1 Parent(s): 501ea68

🤖 Deploy openspiel_env environment - 2025-10-21 14:47:55

Browse files
Dockerfile CHANGED
@@ -1,53 +1,9 @@
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=ghcr.io/meta-pytorch/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
23
- WORKDIR /repo
24
-
25
- # Clone OpenSpiel
26
- RUN git clone https://github.com/google-deepmind/open_spiel.git .
27
-
28
- # Run OpenSpiel's installation script (downloads C++ dependencies)
29
- RUN ./install.sh
30
-
31
- # Install Python dependencies
32
- RUN pip3 install --no-cache-dir --upgrade setuptools testresources importlib_metadata
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
 
1
+ # OpenSpiel environment using pre-built OpenSpiel base image
2
+ # Use the pre-built OpenSpiel base image (contains compiled OpenSpiel)
3
+ # Built from: docker build -t openspiel-base:latest -f src/envs/openspiel_env/server/Dockerfile.openspiel-base .
4
  # In GitHub Actions, this is overridden to use the GHCR base image
5
+ ARG OPENSPIEL_BASE_IMAGE=openspiel-base:latest
6
+ FROM ${OPENSPIEL_BASE_IMAGE}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  # Copy OpenEnv core (base image already set WORKDIR=/app)
9
  WORKDIR /app
src/envs/openspiel_env/server/Dockerfile CHANGED
@@ -4,55 +4,11 @@
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
- FROM ${BASE_IMAGE}
12
-
13
- # Avoid interactive prompts during build
14
- ENV DEBIAN_FRONTEND=noninteractive
15
- ENV TZ=UTC
16
-
17
- # Install build dependencies (curl already installed by openenv-base)
18
- RUN apt-get update && apt-get install -y --no-install-recommends \
19
- build-essential \
20
- clang \
21
- cmake \
22
- git \
23
- sudo \
24
- && rm -rf /var/lib/apt/lists/*
25
-
26
- # Set up OpenSpiel build directory
27
- RUN mkdir /repo
28
- WORKDIR /repo
29
-
30
- # Clone OpenSpiel
31
- RUN git clone https://github.com/google-deepmind/open_spiel.git .
32
-
33
- # Run OpenSpiel's installation script (downloads C++ dependencies)
34
- RUN ./install.sh
35
-
36
- # Install Python dependencies
37
- RUN pip3 install --no-cache-dir --upgrade setuptools testresources importlib_metadata
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
 
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 pre-built OpenSpiel base image
8
+ # Built from: docker build -t openspiel-base:latest -f src/envs/openspiel_env/server/Dockerfile.openspiel-base .
9
  # In GitHub Actions, this is overridden to use the GHCR base image
10
+ ARG OPENSPIEL_BASE_IMAGE=openspiel-base:latest
11
+ FROM ${OPENSPIEL_BASE_IMAGE}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
  # Copy OpenEnv core (base image already set WORKDIR=/app)
14
  WORKDIR /app
src/envs/openspiel_env/server/Dockerfile.openspiel-base ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ # All rights reserved.
3
+ #
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
+ # Pre-built OpenSpiel base image
8
+ # This image contains OpenSpiel compiled and ready to use
9
+ # Built from: docker build -t openspiel-base:latest -f src/envs/openspiel_env/server/Dockerfile.openspiel-base .
10
+ # In GitHub Actions, this is overridden to use the GHCR base image
11
+ ARG BASE_IMAGE=ghcr.io/meta-pytorch/openenv-base:latest
12
+ FROM ${BASE_IMAGE}
13
+
14
+ # Avoid interactive prompts during build
15
+ ENV DEBIAN_FRONTEND=noninteractive
16
+ ENV TZ=UTC
17
+
18
+ # Install build dependencies (curl already installed by openenv-base)
19
+ RUN apt-get update && apt-get install -y --no-install-recommends \
20
+ build-essential \
21
+ clang \
22
+ cmake \
23
+ git \
24
+ sudo \
25
+ && rm -rf /var/lib/apt/lists/*
26
+
27
+ # Set up OpenSpiel build directory
28
+ RUN mkdir /repo
29
+ WORKDIR /repo
30
+
31
+ # Clone OpenSpiel
32
+ RUN git clone https://github.com/google-deepmind/open_spiel.git .
33
+
34
+ # Run OpenSpiel's installation script (downloads C++ dependencies)
35
+ RUN ./install.sh
36
+
37
+ # Install Python dependencies
38
+ RUN pip3 install --no-cache-dir --upgrade setuptools testresources importlib_metadata
39
+ RUN pip3 install --no-cache-dir --upgrade -r requirements.txt cmake
40
+
41
+ # Build OpenSpiel with Python 3.11
42
+ # Use the exact same Python executable as the base image
43
+ RUN mkdir -p build
44
+ WORKDIR /repo/build
45
+ RUN cmake -DPython3_EXECUTABLE=/usr/local/bin/python3 -DCMAKE_CXX_COMPILER=$(which clang++) ../open_spiel
46
+ RUN make -j$(nproc) pyspiel
47
+
48
+ # Install OpenSpiel Python requirements
49
+ WORKDIR /repo
50
+ RUN pip3 install --no-cache-dir --upgrade -r requirements.txt
51
+
52
+ # Set Python path for OpenSpiel
53
+ ENV PYTHONPATH=/repo:/repo/build/python:${PYTHONPATH}
54
+
55
+ # Test OpenSpiel import to verify ABI compatibility
56
+ RUN python3 -c "import pyspiel; print('OpenSpiel import successful')" || echo "OpenSpiel import failed"
57
+
58
+ # Clean up build dependencies to reduce image size
59
+ RUN apt-get remove -y build-essential clang cmake git sudo || true && \
60
+ apt-get autoremove -y && \
61
+ apt-get clean && \
62
+ rm -rf /var/lib/apt/lists/*
63
+
64
+ # Set working directory back to /app (standard for openenv-base)
65
+ WORKDIR /app