Skip to content

Commit 5bdfde6

Browse files
authored
Merge pull request #254 from njustesen/feature/docker
Dockerfile and dependency version updates
2 parents cb018c7 + 1a30259 commit 5bdfde6

File tree

6 files changed

+106
-53
lines changed

6 files changed

+106
-53
lines changed

.github/workflows/pythonpackage.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Python package
22

3-
on: [push, pull_request]
3+
on: [pull_request]
44

55
jobs:
66
build:
@@ -9,25 +9,30 @@ jobs:
99
strategy:
1010
max-parallel: 4
1111
matrix:
12-
python-version: [3.7, 3.8, 3.9, '3.10']
12+
python-version: [3.8, 3.9, '3.10', '3.11']
1313

1414
steps:
1515
- uses: actions/checkout@v1
16+
1617
- name: Set up Python ${{ matrix.python-version }}
1718
uses: actions/setup-python@v1
1819
with:
1920
python-version: ${{ matrix.python-version }}
21+
2022
- name: Install dependencies
2123
run: |
2224
python -m pip install --upgrade pip
23-
pip install .
25+
pip install -e .
26+
python setup.py install
27+
2428
- name: Lint with flake8
2529
run: |
2630
pip install flake8
2731
# stop the build if there are Python syntax errors or undefined names
2832
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
2933
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
3034
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
35+
3136
- name: Test with pytest
3237
run: |
3338
pip install pytest

Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM python:3.9
2+
3+
RUN pip install --upgrade pip
4+
5+
WORKDIR /home/botbowl
6+
COPY requirements.txt ./
7+
RUN pip install -r requirements.txt
8+
9+
COPY . .
10+
RUN python setup.py install
11+
12+
WORKDIR /home/
13+
14+
CMD ["python botbowl/examples/server_example.py"]

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,17 @@ Please cite our paper if you use botbowl in your publications.
1717
Read more about the challenges and achievements in [Papers.md](docs/papers.md)
1818

1919
## Installation
20-
[Make sure python 3.6 or newer is installed, together with pip.](https://www.makeuseof.com/tag/install-pip-for-python/)
20+
21+
### Quickstart with docker
22+
A docker image ready for playing in the web framework as well as doing bot development can be found at `mbermell/botbowl:latest`. To start a web server with docker run:
23+
```shell
24+
docker run -p 1234:1234 -t mbermell/botbowl
25+
```
26+
Go to: http://127.0.0.1:1234/
27+
28+
### Installation with Pip
29+
30+
[Make sure python 3.8 or newer is installed, together with pip.](https://www.makeuseof.com/tag/install-pip-for-python/)
2131
Then run:
2232
```
2333
pip install git+https://github.com/njustesen/botbowl

examples/server_example.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
#!/usr/bin/env python3
2+
import os
23
from scripted_bot_example import *
34

45
import botbowl.web.server as server
56

67
if __name__ == "__main__":
7-
server.start_server(debug=True, use_reloader=False, port=1234)
8+
if os.path.exists("/.dockerenv"):
9+
# If you're running in a docker container, you want the server to be accessible from outside the container.
10+
host = "0.0.0.0"
11+
else:
12+
# If you're running locally, you want the server to be accessible from localhost only b/c of security.
13+
host = "127.0.0.1"
14+
15+
server.start_server(host=host, debug=True, use_reloader=False, port=1234)

requirements.txt

Lines changed: 40 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,41 @@
1-
atomicwrites==1.3.0
2-
attrs==19.3.0
3-
certifi==2019.9.11
4-
chardet==3.0.4
5-
Click==7.0
6-
cloudpickle==1.2.2
7-
Cython==3.0.0a9
8-
-e git+https://github.com/njustesen/botbowl.git@71383a54e36a165b6e52aafe00c2e6846336148c#egg=botbowl
9-
Flask==1.1.1
10-
future==0.18.2
11-
gym==0.15.4
12-
idna==2.8
13-
importlib-metadata==0.23
14-
itsdangerous==1.1.0
15-
Jinja2==2.11.3
16-
MarkupSafe==1.1.1
17-
matplotlib==3.2.0
18-
more-itertools==7.2.0
19-
numpy==1.17.4
20-
opencv-python==4.2.0.32
21-
packaging==19.2
22-
pluggy==0.13.0
23-
py==1.10.0
24-
pyglet==1.3.2
25-
pyparsing==2.4.5
26-
pytest==5.2.2
27-
python-interface==1.5.1
28-
requests==2.22.0
29-
scipy==1.3.2
30-
six==1.13.0
1+
certifi==2023.5.7
2+
charset-normalizer==3.1.0
3+
click==8.1.3
4+
cloudpickle==2.2.1
5+
contourpy==1.0.7
6+
cycler==0.11.0
7+
Cython==3.0.0b2
8+
defusedxml==0.7.1
9+
docker==6.1.1
10+
exceptiongroup==1.1.1
11+
Flask==2.3.2
12+
fonttools==4.39.3
13+
gym==0.26.2
14+
gym-notices==0.0.8
15+
idna==3.4
16+
importlib-metadata==6.6.0
17+
importlib-resources==5.12.0
18+
iniconfig==2.0.0
19+
itsdangerous==2.1.2
20+
Jinja2==3.1.2
21+
kiwisolver==1.4.4
22+
MarkupSafe==2.1.2
23+
matplotlib==3.7.1
24+
more-itertools==9.1.0
25+
numpy==1.24.3
26+
packaging==23.1
27+
Pillow==9.5.0
28+
pluggy==1.0.0
29+
pyparsing==3.0.9
30+
pytest==7.3.1
31+
python-dateutil==2.8.2
32+
python-interface==1.6.1
33+
requests==2.30.0
34+
six==1.16.0
3135
stopit==1.1.2
32-
untangle==1.1.1
33-
urllib3==1.26.5
34-
wcwidth==0.1.7
35-
Werkzeug==0.16.0
36-
zipp==0.6.0
36+
tomli==2.0.1
37+
untangle==1.2.1
38+
urllib3==2.0.2
39+
websocket-client==1.5.1
40+
Werkzeug==2.3.3
41+
zipp==3.15.0

setup.py

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44
from distutils.ccompiler import new_compiler
55
from distutils.errors import DistutilsPlatformError
66

7+
# warn user if setup.py is run from a different directory
8+
dir_of_file = os.path.dirname(__file__)
9+
cwd = os.getcwd()
10+
if dir_of_file != cwd:
11+
# We should make this warning obsolete..
12+
print(f"WARNING: setup.py is being run from a different directory than the install script. This can cause strange errors"
13+
f"Current directory='{cwd}', dir of file='{dir_of_file}'")
14+
15+
16+
717
try:
818
error_msg = None
919
from Cython.Build import cythonize
@@ -35,23 +45,24 @@
3545
files_to_compile = ["botbowl/core/pathfinding/cython_pathfinding.pyx"]
3646

3747
install_requires_packages = [
38-
'numpy',
39-
'untangle',
40-
'Flask',
41-
'gym==0.21.0',
42-
'Jinja2',
43-
'python-interface',
44-
'stopit',
45-
'requests',
46-
'Cython >= 3.0a7',
47-
'pytest',
48-
'matplotlib',
49-
'more_itertools'
48+
'numpy==1.24.3',
49+
'untangle==1.2.1',
50+
'Flask==2.3.2',
51+
'gym==0.26.2',
52+
'Jinja2==3.1.2',
53+
'docker==6.1.1',
54+
'python-interface==1.6.1',
55+
'stopit==1.1.2',
56+
'requests==2.30.0',
57+
'Cython==3.0.0b2',
58+
'pytest==7.3.1',
59+
'matplotlib==3.7.1',
60+
'more_itertools==9.1.0'
5061
]
5162

5263
kwargs = {
5364
'name': 'botbowl',
54-
'version': '0.4.0',
65+
'version': '1.1.0',
5566
'include_package_data': True,
5667
'install_requires': install_requires_packages,
5768
'packages': find_packages(),

0 commit comments

Comments
 (0)