-
Notifications
You must be signed in to change notification settings - Fork 323
/
Copy pathDockerfile
45 lines (39 loc) · 1.77 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
ARG base
FROM ${base}
ARG PYTHON_VERSION
USER gitpod
# Dazzle does not rebuild a layer until one of its lines are changed. Increase this counter to rebuild this layer.
ENV TRIGGER_REBUILD=1
ENV PATH="$HOME/.pyenv/bin:$HOME/.pyenv/shims:$PATH"
ENV PIPENV_VENV_IN_PROJECT=true
ENV PYENV_ROOT="$HOME/.pyenv"
# configure the default intepreter for PyCharm
ENV PYCHARM_PYTHON_PATH="$HOME/.pyenv/shims/python"
RUN sudo install-packages \
# Install python compiling dependencies for pyenv
python3-pip make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev \
# Install PYENV
&& git clone https://github.com/pyenv/pyenv.git ~/.pyenv \
&& git -C ~/.pyenv checkout ff93c58babd813066bf2d64d004a5cee33c0f27b \
&& pyenv install ${PYTHON_VERSION} \
&& pyenv global ${PYTHON_VERSION} \
&& for exec in global; do printf '%s\n' 'source "$HOME/.gp_pyenv.d/userbase.bash"' >> "$PYENV_ROOT/libexec/pyenv-$exec"; done \
# Install additional python packages
&& python3 -m pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir --upgrade \
setuptools wheel virtualenv pipenv pylint rope flake8 \
mypy autopep8 pep8 pylama pydocstyle bandit notebook \
twine
# Install poetry
RUN if echo $PYTHON_VERSION | grep -q "3.6.*"; then \
curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.1.15 python; \
else \
curl -sSL https://install.python-poetry.org | python; \
fi
RUN sudo rm -rf /tmp/*
COPY --chown=gitpod:gitpod pyenv.d $HOME/.gp_pyenv.d
COPY --chown=gitpod:gitpod userbase.bash $HOME/.gp_pyenv.d
COPY --chown=gitpod:gitpod python_hook.bash $HOME/.bashrc.d/60-python
COPY --chown=gitpod:gitpod avoid_userbase_hook.bash $HOME/.pyenv/pyenv.d/exec