-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathDockerfile
81 lines (71 loc) · 2.61 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# To build, navigate to the *root* of this repo and run:
# docker build . -f compose/python/Dockerfile -t humancompatibleai/goattack:python
# KataGo is most stable with TF 1.15
# See https://github.com/lightvector/KataGo/blob/master/SelfplayTraining.md.
#
# https://docs.nvidia.com/deeplearning/frameworks/tensorflow-release-notes/rel_22-01.html
FROM nvcr.io/nvidia/tensorflow:22.01-tf1-py3 AS build-deps
ENV DEBIAN_FRONTEND=noninteractive
# Install utilities
RUN apt-get update -q \
&& apt-get install -y \
curl \
git \
python3-venv \
sudo \
tmux \
unzip \
uuid-runtime \
vim \
wget \
# Clean up
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Create virtualenv and 'activate' it by adjusting PATH.
# See https://pythonspeed.com/articles/activate-virtualenv-dockerfile/.
ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV --system-site-packages
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# NVidia Dockerfile sets BASH_ENV to source bashrc always which causes some
# KataGo scripts to complain about unset PS1 -- unset this in the entrypoint.
RUN echo "unset BASH_ENV" > /opt/nvidia/entrypoint.d/01-unset_bash_env.sh
FROM build-deps as python-deps
# Install python requirements within virtualenv
RUN pip install --no-cache-dir --upgrade pip setuptools
COPY ./compose/python/requirements.txt /downloads/requirements.txt
RUN pip install --no-cache-dir -r /downloads/requirements.txt
FROM python-deps as prod
# Copy over KataGo python files
COPY ./engines/KataGo-raw/python /engines/KataGo-raw/python
COPY ./engines/KataGo-tensorflow/python /engines/KataGo-tensorflow/python
COPY ./engines/KataGo-custom/python /engines/KataGo-custom/python
# Make /engines/KataGo-* git repos to make scripts run nicely.
# TODO: Make this less hacky...
WORKDIR /engines/KataGo-raw
RUN git init . \
&& git add . \
&& git config user.name dummy_name \
&& git config user.email [email protected] \
&& git commit -m "Dummy commit"
WORKDIR /engines/KataGo-tensorflow
RUN git init . \
&& git add . \
&& git config user.name dummy_name \
&& git config user.email [email protected] \
&& git commit -m "Dummy commit"
WORKDIR /engines/KataGo-custom
RUN git init . \
&& git add . \
&& git config user.name dummy_name \
&& git config user.email [email protected] \
&& git commit -m "Dummy commit"
COPY ./src/go_attack /go_attack/src/go_attack
COPY ./setup.py /go_attack/setup.py
COPY ./scripts/ /go_attack/scripts
COPY ./kubernetes/ /go_attack/kubernetes
COPY ./configs/ /go_attack/configs
# Make the git commit visible to the image if provided as a --build-arg
ARG ARG_GIT_COMMIT
ENV GIT_COMMIT=$ARG_GIT_COMMIT
# Reset working directory
WORKDIR /