forked from python-mode/python-mode
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.base
More file actions
76 lines (68 loc) · 2.54 KB
/
Dockerfile.base
File metadata and controls
76 lines (68 loc) · 2.54 KB
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
FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHON_CONFIGURE_OPTS="--enable-shared"
ENV PYENV_ROOT="/opt/pyenv"
ENV PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH"
ARG PYTHON_VERSION=3.13.0
ENV PYTHON_VERSION=${PYTHON_VERSION}
# Install system dependencies for pyenv and Python builds
# TODO: Remove GUI dependencies
RUN apt-get update && apt-get install -yqq \
libncurses5-dev \
libgtk2.0-dev \
libatk1.0-dev \
libcairo2-dev \
libx11-dev \
libxpm-dev \
libxt-dev \
lua5.2 \
liblua5.2-dev \
libperl-dev \
git \
build-essential \
curl \
wget \
ca-certificates \
libssl-dev \
libbz2-dev \
libreadline-dev \
libsqlite3-dev \
zlib1g-dev \
libffi-dev \
liblzma-dev \
&& rm -rf /var/lib/apt/lists/*
# Remove existing vim packages
RUN apt-get remove --purge -yqq vim vim-runtime gvim 2>&1 > /dev/null || true
# Install pyenv
RUN git clone --depth 1 https://github.com/pyenv/pyenv.git $PYENV_ROOT && \
cd $PYENV_ROOT && \
git checkout $(git describe --tags --abbrev=0) && \
eval "$(pyenv init -)" && \
eval "$(pyenv init --path)"
# Set up bash profile for pyenv
RUN echo 'export PYENV_ROOT="/opt/pyenv"' >> /root/.bashrc && \
echo 'export PATH="${PYENV_ROOT}/bin:${PYENV_ROOT}/shims:$PATH"' >> /root/.bashrc && \
echo 'eval "$(pyenv init -)"' >> /root/.bashrc && \
echo 'eval "$(pyenv init --path)"' >> /root/.bashrc && \
echo 'alias python=python3' >> /root/.bashrc
# Install Python versions with pyenv
RUN pyenv install ${PYTHON_VERSION} && \
pyenv global ${PYTHON_VERSION} && \
rm -rf /tmp/python-build*
# Upgrade pip and add some other dependencies
RUN eval "$(pyenv init -)" && \
echo "Upgrading pip for Python ($(python --version): $(which python))..." && \
pip install --upgrade pip setuptools wheel && \
## Python-mode dependency
pip install pytoolconfig
# Build and install Vim from source with Python support for each Python version
RUN cd /tmp && \
git clone --depth 1 https://github.com/vim/vim.git && \
cd vim && \
# Build Vim for each Python version
echo "Building Vim with python support: Python ($(python --version): $(which python))..." && \
make clean || true && \
./configure --with-features=huge --enable-multibyte --enable-python3interp=yes --with-python3-config-dir=$(python-config --configdir) --enable-perlinterp=yes --enable-luainterp=yes --enable-cscope --prefix=/usr/local --exec-prefix=/usr/local && \
make && \
make install && \
echo "Vim for Python $pyver installed as vim"