-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
39 lines (30 loc) · 1.39 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
FROM ubuntu:UBUNTU_TAG
# use bash shell as default
SHELL ["/bin/bash", "-c"]
# install python, pip and pipenv
RUN apt-get update && \
apt-get install -y sudo curl git gcc make openssl libssl-dev libbz2-dev libreadline-dev libsqlite3-dev zlib1g-dev libffi-dev
# add the user Motoko, tribute to https://en.wikipedia.org/wiki/Motoko_Kusanagi
RUN useradd --create-home --shell /bin/bash --no-log-init --system -u 999 motoko && \
echo "motoko ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers
USER motoko
WORKDIR /home/motoko
# set some local environment variables
ENV LANG en_US.UTF-8
# install pyenv for motoko
RUN curl https://pyenv.run | bash
# update path to use pyenv
ENV PATH ~/.pyenv/bin:~/.local/bin:$PATH
# set the bashrc (for interactive sessions) and bash_profile (for login sessions)
RUN echo "eval \"\$(pyenv init -)\"" > ~/.bashrc && \
echo "eval \"\$(pyenv virtualenv-init -)\"" >> ~/.bashrc && \
echo "eval \"\$(pyenv init -)\"" > ~/.bash_profile && \
echo "eval \"\$(pyenv virtualenv-init -)\"" >> ~/.bash_profile
# use login bash shell as default from now on, so that the bash_profile is sourced before any RUN command
SHELL ["/bin/bash", "-lc"]
# install python, upgrade pip, and install pipenv
RUN pyenv update && \
pyenv install PYTHON_VERSION && \
pyenv global PYTHON_VERSION && \
pip --no-cache-dir install --user --upgrade pip && \
pip --no-cache-dir install --user --upgrade pipenv