Skip to content

Docker Base: Setup vim for all python vesions #1188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 34 additions & 12 deletions Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,39 @@ RUN pyenv install 3.10.13 && \
pyenv install 3.12.4 && \
pyenv install 3.13.0

ARG PYTHON_VERSION=3.10.13
ENV PYTHON_VERSION=${PYTHON_VERSION}
RUN pyenv global ${PYTHON_VERSION}
ENV PYTHON_VERSION=3.13.0

# Create virtual environment
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
ENV VIRTUAL_ENV="/opt/venv"
# Upgrade pip for each Python version
RUN for pyver in 3.10.13 3.11.9 3.12.4 3.13.0; do \
echo "Upgrading pip for Python $pyver..." && \
pyenv shell $pyver && \
pip install --upgrade pip setuptools wheel && \
## Python-mode dependency
pip install pytoolconfig; \
done

# Upgrade pip in the virtual environment
RUN pip install --upgrade pip setuptools wheel

# Dependency to load some modules within pyton-mode
RUN pip install pytoolconfig
# Build and install Vim from source with Python support for each Python version
RUN export PYENV_ROOT="/opt/pyenv" && \
export PATH="${PYENV_ROOT}/bin:${PYENV_ROOT}/shims:${PATH}" && \
eval "$(pyenv init -)" && \
eval "$(pyenv init --path)" && \
export PYTHON_CONFIGURE_OPTS="--enable-shared" && \
cd /tmp && \
git clone https://github.com/vim/vim.git && \
cd vim && \
# Build Vim for each Python version
for pyver in 3.10.13 3.11.9 3.12.4 3.13.0; do \
echo "Building Vim for Python $pyver..." && \
pyenv global $pyver && \
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/vim-$pyver && \
make && \
make install && \
mv /usr/local/bin/vim /usr/local/bin/vim-$pyver && \
mv /usr/local/bin/vimtutor /usr/local/bin/vimtutor-$pyver || true && \
mv /usr/local/bin/xxd /usr/local/bin/xxd-$pyver || true && \
echo "Vim for Python $pyver installed as vim-$pyver"; \
done && \
# Set default Vim to use the current global Python version
pyenv global ${PYTHON_VERSION} && \
echo "alias vim='vim-${PYTHON_VERSION}'" >> ~/.bashrc
Loading