@@ -4,8 +4,11 @@ ENV DEBIAN_FRONTEND=noninteractive
44ENV PYTHON_CONFIGURE_OPTS="--enable-shared"
55ENV PYENV_ROOT="/opt/pyenv"
66ENV PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH"
7+ ARG PYTHON_VERSION=3.13.0
8+ ENV PYTHON_VERSION=${PYTHON_VERSION}
79
810# Install system dependencies for pyenv and Python builds
11+ # TODO: Remove GUI dependencies
912RUN apt-get update && apt-get install -yqq \
1013 libncurses5-dev \
1114 libgtk2.0-dev \
@@ -32,30 +35,42 @@ RUN apt-get update && apt-get install -yqq \
3235 && rm -rf /var/lib/apt/lists/*
3336
3437# Remove existing vim packages
35- RUN apt-get remove --purge -yqq vim vim-runtime gvim || true
38+ RUN apt-get remove --purge -yqq vim vim-runtime gvim 2>&1 > /dev/null || true
3639
3740# Install pyenv
38- RUN git clone https://github.com/pyenv/pyenv.git $PYENV_ROOT && \
41+ RUN git clone --depth 1 https://github.com/pyenv/pyenv.git $PYENV_ROOT && \
3942 cd $PYENV_ROOT && \
40- git checkout $(git describe --tags --abbrev=0)
43+ git checkout $(git describe --tags --abbrev=0) && \
44+ eval "$(pyenv init -)" && \
45+ eval "$(pyenv init --path)"
4146
42- # Install Python versions with pyenv
43- RUN pyenv install 3.10.13 && \
44- pyenv install 3.11.9 && \
45- pyenv install 3.12.4 && \
46- pyenv install 3.13.0
47+ # Set up bash profile for pyenv
48+ RUN echo 'export PYENV_ROOT="/opt/pyenv"' >> /root/.bashrc && \
49+ echo 'export PATH="${PYENV_ROOT}/bin:${PYENV_ROOT}/shims:$PATH"' >> /root/.bashrc && \
50+ echo 'eval "$(pyenv init -)"' >> /root/.bashrc && \
51+ echo 'eval "$(pyenv init --path)"' >> /root/.bashrc && \
52+ echo 'alias python=python3' >> /root/.bashrc
4753
48- ARG PYTHON_VERSION=3.10.13
49- ENV PYTHON_VERSION=${PYTHON_VERSION}
50- RUN pyenv global ${PYTHON_VERSION}
51-
52- # Create virtual environment
53- RUN python -m venv /opt/venv
54- ENV PATH="/opt/venv/bin:$PATH"
55- ENV VIRTUAL_ENV="/opt/venv"
54+ # Install Python versions with pyenv
55+ RUN pyenv install ${PYTHON_VERSION} && \
56+ pyenv global ${PYTHON_VERSION} && \
57+ rm -rf /tmp/python-build*
5658
57- # Upgrade pip in the virtual environment
58- RUN pip install --upgrade pip setuptools wheel
59+ # Upgrade pip and add some other dependencies
60+ RUN eval "$(pyenv init -)" && \
61+ echo "Upgrading pip for Python ($(python --version): $(which python))..." && \
62+ pip install --upgrade pip setuptools wheel && \
63+ ## Python-mode dependency
64+ pip install pytoolconfig
5965
60- # Dependency to load some modules within pyton-mode
61- RUN pip install pytoolconfig
66+ # Build and install Vim from source with Python support for each Python version
67+ RUN cd /tmp && \
68+ git clone --depth 1 https://github.com/vim/vim.git && \
69+ cd vim && \
70+ # Build Vim for each Python version
71+ echo "Building Vim with python support: Python ($(python --version): $(which python))..." && \
72+ make clean || true && \
73+ ./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 && \
74+ make && \
75+ make install && \
76+ echo "Vim for Python $pyver installed as vim"
0 commit comments