Skip to content

Commit

Permalink
Merge pull request google-deepmind#171 from yarncraft:patch-3
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 301189852
Change-Id: I663ae12cb8229e7d18d9ab0ea136090baf489f18
  • Loading branch information
open_spiel@google.com authored and open_spiel@google.com committed Mar 16, 2020
2 parents 0e05222 + ad0bc71 commit f811002
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 14 deletions.
33 changes: 21 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:18.04
FROM ubuntu:18.04 as base
RUN apt update
RUN dpkg --add-architecture i386 && apt update
RUN apt-get -y install \
Expand All @@ -11,27 +11,36 @@ RUN apt-get -y install \
python3-setuptools \
python3-wheel \
sudo
RUN mkdir repo
WORKDIR /repo

RUN sudo pip3 install --upgrade pip
RUN sudo pip3 install matplotlib

# install
COPY . .
RUN ./install.sh

RUN pip3 install --upgrade setuptools testresources
RUN pip3 install --upgrade -r requirements.txt
RUN pip3 install --upgrade cmake

# build and test
RUN mkdir -p build && \
cd build && \
cmake -DPython_TARGET_VERSION=${PYVERSION} -DCMAKE_CXX_COMPILER=`which clang++` ../open_spiel && \
make -j4 && \
ctest -j4
COPY . build

ENV PYTHONPATH=${PYTHONPATH}:/
ENV PYTHONPATH=${PYTHONPATH}:/build/python
RUN mkdir -p build
WORKDIR /repo/build
RUN cmake -DPython_TARGET_VERSION=${PYVERSION} -DCMAKE_CXX_COMPILER=`which clang++` ../open_spiel
RUN make -j12
RUN ctest -j12
ENV PYTHONPATH=${PYTHONPATH}:/repo
ENV PYTHONPATH=${PYTHONPATH}:/repo/build/python
WORKDIR /repo/open_spiel

WORKDIR ./open_spiel
# minimal image for development in Python
FROM python:3.6-slim-buster as python-slim
RUN mkdir repo
WORKDIR /repo
COPY --from=base /repo .
RUN pip3 install --upgrade -r requirements.txt
RUN pip3 install matplotlib
ENV PYTHONPATH=${PYTHONPATH}:/repo
ENV PYTHONPATH=${PYTHONPATH}:/repo/build/python
WORKDIR /repo/open_spiel
23 changes: 21 additions & 2 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,30 @@ Linux versions).

## Installing via Docker

In the top-level directory:
Option 1 (Basic, 3.13GB):

```bash
docker build --target base -t openspiel . --rm
```

Option 2 (Slim, 2.26GB):

```bash
docker build --target python-slim -t openspiel . --rm
```

If you are only interested in developing in Python, use the second image. You
can navigate through the runtime of the container (after the build step) with:

```bash
docker run -it --entrypoint /bin/bash openspiel
```

Finally you can run examples using:

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

## Running the first examples
Expand Down

0 comments on commit f811002

Please sign in to comment.