forked from salesforce/fast-influence-functions
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
102 lines (93 loc) · 4.26 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# syntax = docker/dockerfile:1.0-experimental
FROM pytorch/pytorch:1.5.1-cuda10.1-cudnn7-runtime
# working directory
WORKDIR /workspace
# ---------------------------------------------
# Project-agnostic System Dependencies
# ---------------------------------------------
RUN \
# Install System Dependencies
apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cmake \
wget \
unzip \
psmisc \
vim \
git \
ssh \
curl \
lshw \
ubuntu-drivers-common \
ca-certificates \
libjpeg-dev \
libpng-dev && \
rm -rf /var/lib/apt/lists/* && \
# Install NVIDIA Driver
# https://www.linuxbabe.com/ubuntu/install-nvidia-driver-ubuntu-18-04
# ubuntu-drivers autoinstall && \
# https://serverfault.com/questions/227190/how-do-i-ask-apt-get-to-skip-any-interactive-post-install-configuration-steps
# https://stackoverflow.com/questions/38165407/installing-lightdm-in-dockerfile-raises-interactive-keyboard-layout-menu
# apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
# nvidia-driver-440 && \
# rm -rf /var/lib/apt/lists/* && \
# Install NodeJS
# https://github.com/nodesource/distributions/blob/master/README.md#deb
curl -sL https://deb.nodesource.com/setup_12.x | bash - && \
apt-get install -y nodejs
# ---------------------------------------------
# Project-specific System Dependencies
# ---------------------------------------------
RUN \
# Install `graph_tool`
# https://git.skewed.de/count0/graph-tool/-/wikis/installation-instructions#debian-ubuntu
# and `cairo` https://cairographics.org/download/
echo "deb [ arch=amd64 ] https://downloads.skewed.de/apt bionic main" >> /etc/apt/sources.list && \
apt-key adv --keyserver keys.openpgp.org --recv-key 612DEFB798507F25 && \
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
python3-graph-tool \
libcairo2-dev && \
rm -rf /var/lib/apt/lists/* && \
# Link the directory to `graph_tool`, which is installed in a differet python path
ln -s /usr/lib/python3/dist-packages/graph_tool/ /opt/conda/lib/python3.7/site-packages/graph_tool
# Clone the Apex Module (this requires torch)
# git clone https://github.com/NVIDIA/apex /workspace/apex && \
# cd /workspace/apex && \
# pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./ && \
# ---------------------------------------------
# Build Python depencies and utilize caching
# ---------------------------------------------
COPY ./fast-influence-functions/requirements.txt /workspace/fast-influence-functions/requirements.txt
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r /workspace/fast-influence-functions/requirements.txt && \
# Jupyter Extensions (https://plot.ly/python/getting-started/):
# Avoid "JavaScript heap out of memory" errors during extension installation (OS X/Linux)
export NODE_OPTIONS=--max-old-space-size=4096 && \
jupyter labextension install @jupyter-widgets/jupyterlab-manager --no-build && \
jupyter labextension install @oriolmirosa/jupyterlab_materialdarker --no-build && \
jupyter lab build && \
# Unset NODE_OPTIONS environment variable (OS X/Linux)
unset NODE_OPTIONS && \
# for binding/linking path from host machines
mkdir -p /nlp && \
mkdir -p /export/ && \
chmod -R 777 /export
# upload everything
COPY ./fast-influence-functions/ /workspace/fast-influence-functions/
# Set HOME
ENV HOME="/workspace/fast-influence-functions"
# ---------------------------------------------
# Project-agnostic User-dependent Dependencies
# ---------------------------------------------
RUN \
# Install FZF the fuzzy finder
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf && \
~/.fzf/install --all && \
# Install Awesome vimrc
git clone --depth=1 https://github.com/amix/vimrc.git ~/.vim_runtime && \
sh ~/.vim_runtime/install_awesome_vimrc.sh
# Reset Entrypoint from Parent Images
# https://stackoverflow.com/questions/40122152/how-to-remove-entrypoint-from-parent-image-on-dockerfile/40122750
ENTRYPOINT []
# load bash
CMD /bin/bash