Skip to content

Commit 61c296c

Browse files
committed
Docker Base: Setup vim for all python vesions
1 parent b0202df commit 61c296c

File tree

1 file changed

+34
-12
lines changed

1 file changed

+34
-12
lines changed

Dockerfile.base

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,39 @@ RUN pyenv install 3.10.13 && \
4545
pyenv install 3.12.4 && \
4646
pyenv install 3.13.0
4747

48-
ARG PYTHON_VERSION=3.10.13
49-
ENV PYTHON_VERSION=${PYTHON_VERSION}
50-
RUN pyenv global ${PYTHON_VERSION}
48+
ENV PYTHON_VERSION=3.13.0
5149

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

57-
# Upgrade pip in the virtual environment
58-
RUN pip install --upgrade pip setuptools wheel
59-
60-
# Dependency to load some modules within pyton-mode
61-
RUN pip install pytoolconfig
59+
# Build and install Vim from source with Python support for each Python version
60+
RUN export PYENV_ROOT="/opt/pyenv" && \
61+
export PATH="${PYENV_ROOT}/bin:${PYENV_ROOT}/shims:${PATH}" && \
62+
eval "$(pyenv init -)" && \
63+
eval "$(pyenv init --path)" && \
64+
export PYTHON_CONFIGURE_OPTS="--enable-shared" && \
65+
cd /tmp && \
66+
git clone https://github.com/vim/vim.git && \
67+
cd vim && \
68+
# Build Vim for each Python version
69+
for pyver in 3.10.13 3.11.9 3.12.4 3.13.0; do \
70+
echo "Building Vim for Python $pyver..." && \
71+
pyenv global $pyver && \
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/vim-$pyver && \
74+
make && \
75+
make install && \
76+
mv /usr/local/bin/vim /usr/local/bin/vim-$pyver && \
77+
mv /usr/local/bin/vimtutor /usr/local/bin/vimtutor-$pyver || true && \
78+
mv /usr/local/bin/xxd /usr/local/bin/xxd-$pyver || true && \
79+
echo "Vim for Python $pyver installed as vim-$pyver"; \
80+
done && \
81+
# Set default Vim to use the current global Python version
82+
pyenv global ${PYTHON_VERSION} && \
83+
echo "alias vim='vim-${PYTHON_VERSION}'" >> ~/.bashrc

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy