-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile.jax
91 lines (80 loc) · 2.66 KB
/
Dockerfile.jax
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
FROM ubuntu:22.04
USER root
## add a conda for python 3 environment
# Install miniconda - this is from
# https://github.com/ContinuumIO/docker-images/blob/master/miniconda3/debian/Dockerfile
# =================================
# hadolint ignore=DL3008
# xterm for x11 forwarding
RUN apt-get update -q && \
apt-get install -q -y --no-install-recommends \
bzip2 \
ca-certificates \
git \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender1 \
mercurial \
subversion \
wget \
xterm \
libglu1-mesa-dev \
libgl1-mesa-dev \
libosmesa6-dev \
xvfb \
patchelf \
ffmpeg \
cmake \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ENV PATH /opt/conda/bin:$PATH
# Leave these args here to better use the Docker build cache
ARG CONDA_VERSION=py38_4.9.2
ARG CONDA_MD5=122c8c9beb51e124ab32a0fa6426c656
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-${CONDA_VERSION}-Linux-x86_64.sh -O miniconda.sh && \
echo "${CONDA_MD5} miniconda.sh" > miniconda.md5 && \
if ! md5sum --status -c miniconda.md5; then exit 1; fi && \
mkdir -p /opt && \
sh miniconda.sh -b -p /opt/conda && \
rm miniconda.sh miniconda.md5 && \
ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \
echo "conda activate base" >> ~/.bashrc && \
find /opt/conda/ -follow -type f -name '*.a' -delete && \
find /opt/conda/ -follow -type f -name '*.js.map' -delete && \
/opt/conda/bin/conda clean -afy
# Install
# add ipykernel for jupyter notebook in devcontainer
RUN conda update -c defaults conda && \
conda config --add channels conda-forge && \
conda install pip \
matplotlib \
scipy \
numpy \
pandas\
ipykernel && \
conda clean -ya
# install jax ecosystem
RUN pip install --upgrade pip && \
pip install flax jax jaxlib gymnasium[classic-control]
# install convex optimziation
#RUN pip install cvxpy==1.3.0 diffcp==1.0.21 cvxpylayers==0.1.5
# X forwarding
# render using X11
RUN export uid=1000 gid=1000 && \
mkdir -p /home/developer && \
mkdir -p /etc/sudoers.d && \
echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd && \
echo "developer:x:${uid}:" >> /etc/group && \
echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer && \
chmod 0440 /etc/sudoers.d/developer && \
chown ${uid}:${gid} -R /home/developer && \
mkdir -m 1777 /tmp/.X11-unix
USER developer
ENV HOME /home/developer
WORKDIR $HOME
# activate conda environment
RUN conda init bash && \
. ~/.bashrc
SHELL ["conda", "run", "-n", "base", "/bin/bash", "-c"]