~dvshkn/docker-anaconda-py3

ref: 714559dbdb85ba07074848378253eedcd7d2d24e docker-anaconda-py3/Dockerfile -rw-r--r-- 1.2 KiB
714559dbDavid Knight update Dockerfile to handle macos staff group (gid collision) 1 year, 3 months ago
                                                                                
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
FROM ubuntu:bionic
LABEL maintainer="david@dvshkn.com"

ARG uid=1000
ARG gid=1000

SHELL ["/bin/bash", "-c"]

# updates and packages
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y sudo vim

# setup the login group
# - create new group if the gid isn't taken (usual case on linux host)
# - commandeer the group if the gid is taken (usual case on macos host)
RUN EXISTING_GROUP=$(cat /etc/group | grep ":$gid:" | awk '{split($0,s,":"); print s[1]}'); [[ $EXISTING_GROUP ]] && groupmod --new-name user $EXISTING_GROUP || groupadd --gid $gid user

# finally setup regular user
RUN groupadd wheel
RUN useradd -m -s /bin/bash --uid $uid --gid $gid -G wheel user
RUN echo 'user:docker' | chpasswd

# install anaconda
COPY --chown=user:user files/anaconda_installer.sh /home/user/anaconda_installer.sh
RUN su user -lc $'bash ~/anaconda_installer.sh -b -p $HOME/anaconda'
RUN su user -lc $'echo \'export PATH=$HOME/anaconda/bin:$PATH\' >> $HOME/.bashrc'

# data dir for mounting
RUN su user -lc $'mkdir $HOME/data'

# jupyter notebook config
RUN su user -lc $'mkdir $HOME/.jupyter'
COPY --chown=user:user files/jupyter_notebook_config.py /home/user/.jupyter/jupyter_notebook_config.py

# cleanup
RUN su user -lc $'rm $HOME/anaconda_installer.sh'