Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 61 additions & 23 deletions Dockerfile.base
Original file line number Diff line number Diff line change
@@ -1,48 +1,86 @@
FROM ubuntu:20.04 as base
RUN apt update
RUN apt-get -y install \

ARG UBUNTU_VERSION=24.04
ARG PYTHON_VERSION=3.12

FROM ubuntu:${UBUNTU_VERSION} as base

#re-declaring it locally
ARG PYTHON_VERSION=3.12

ARG DEBIAN_FRONTEND=noninteractive
# using all processes by devault
ARG NPROC=12

#for some regions, it's useful
ENV LANG=C.UTF-8

RUN apt-get update && \
apt-get -qq -y install \
software-properties-common \
build-essential \
clang \
curl \
git \
python3 \
python3-dev \
python3-pip \
python3-setuptools \
python3-wheel \
sudo
vim \
tmux \
sudo \
tzdata \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# installing the python we need
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt-get update && apt-get install -y -qq python${PYTHON_VERSION} \
python${PYTHON_VERSION}-dev \
python${PYTHON_VERSION}-venv

# installing the newest pip
RUN update-alternatives --install /usr/bin/python python /usr/bin/python${PYTHON_VERSION} 1
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python${PYTHON_VERSION} 1

RUN python -m venv /opt/venv
# Ensure the container uses the venv's python and pip automatically
ENV PATH="/opt/venv/bin:$PATH"


RUN mkdir repo
WORKDIR /repo

RUN sudo pip3 install --upgrade pip
RUN sudo pip3 install matplotlib
RUN pip --no-cache-dir install matplotlib

# install
COPY . .
RUN DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata
RUN ./install.sh
RUN pip3 install --upgrade setuptools testresources
# Line below is a workaround for the issue https://github.com/google-deepmind/open_spiel/issues/1293
RUN pip install importlib_metadata --force-reinstall
RUN pip3 install --upgrade -r requirements.txt
RUN pip3 install --upgrade cmake
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# build and test
RUN mkdir -p build
WORKDIR /repo/build
RUN cmake -DPython3_EXECUTABLE=`which python3` -DCMAKE_CXX_COMPILER=`which clang++` ../open_spiel
RUN make -j12
RUN cmake -DPython3_EXECUTABLE=`which python` -DCMAKE_CXX_COMPILER=`which clang++` ../open_spiel
RUN make -j${NPROC}

ENV PYTHONPATH=${PYTHONPATH}:/repo
ENV PYTHONPATH=${PYTHONPATH}:/repo/build/python
RUN ctest -j12
RUN ctest -j${NPROC}
WORKDIR /repo/open_spiel

# minimal image for development in Python
FROM python:3.6-slim-buster as python-slim
FROM python:${PYTHON_VERSION}-slim as python-slim

RUN mkdir repo
WORKDIR /repo
COPY --from=base /repo .
RUN pip3 install --upgrade -r requirements.txt
RUN pip3 install matplotlib

RUN pip install --upgrade -r requirements.txt
RUN pip install matplotlib

ENV PYTHONPATH=${PYTHONPATH}:/repo
ENV PYTHONPATH=${PYTHONPATH}:/repo/build/python
WORKDIR /repo/open_spiel

# jupyterlab Environment
FROM base as jupyterlab

RUN pip install jupyter -U && pip install jupyterlab
EXPOSE 8888
ENTRYPOINT ["jupyter", "lab", "--ip=0.0.0.0", "--allow-root"]
42 changes: 0 additions & 42 deletions Dockerfile.jupyter

This file was deleted.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

[![Documentation Status](https://readthedocs.org/projects/openspiel/badge/?version=latest)](https://openspiel.readthedocs.io/en/latest/?badge=latest)
![build_and_test](https://github.com/deepmind/open_spiel/workflows/build_and_test/badge.svg)
[![Python 3.11](https://img.shields.io/badge/python-3.11-blue.svg)](https://www.python.org)

OpenSpiel is a collection of environments and algorithms for research in general
reinforcement learning and search/planning in games. OpenSpiel supports n-player
Expand Down
6 changes: 3 additions & 3 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ docker run -it --entrypoint /bin/bash openspiel
Finally you can run examples using:

```bash
docker run openspiel python3 python/examples/matrix_game_example.py
docker run openspiel python3 python/examples/example.py
docker run openspiel python python/examples/matrix_game_example.py
docker run openspiel python python/examples/example.py
```


Expand All @@ -197,7 +197,7 @@ Option 3 (Jupyter Notebook):
Installs OpenSpiel with an additional Jupyter Notebook environment.

```bash
docker build -t openspiel-notebook -f Dockerfile.jupyter --rm .
docker build --target jupyterlab -t openspiel-notebook -f Dockerfile.base --rm .
docker run -it --rm -p 8888:8888 openspiel-notebook
```

Expand Down
Loading