|
| 1 | +# VERSION 1.0.0 |
| 2 | +# AUTHOR: Diego Rabatone Oliveira (@diraol) |
| 3 | +# DESCRIPTION: Image used to test python-mode |
| 4 | +# BUILD: Use the build_docker_images.sh file |
| 5 | +# docker build -t python-mode:<VER> -f Dockerfile --build-arg PYTHON=<VER> . |
| 6 | +# SOURCE: https://github.com/python-mode/python-mode |
| 7 | +ARG PYTHON |
| 8 | +FROM python:$PYTHON |
| 9 | + |
| 10 | +# Passing arg inside the build stage |
| 11 | +ARG PYTHON |
| 12 | + |
| 13 | +# Never prompts the user for choices on installation/configuration of packages |
| 14 | +ENV DEBIAN_FRONTEND noninteractive |
| 15 | +ENV TERM linux |
| 16 | + |
| 17 | +# https://docs.python.org/3.6/using/cmdline.html#envvar-PYTHONUNBUFFERED |
| 18 | +# https://github.com/sclorg/s2i-python-container/issues/157 |
| 19 | +ENV PYTHONUNBUFFERED 1 |
| 20 | + |
| 21 | +# Clonning and building VIM for the specific python version |
| 22 | +COPY ./tests/utils/build_vim.sh /opt/build_vim.sh |
| 23 | +RUN set -ex \ |
| 24 | + && cd /opt \ |
| 25 | + && chmod +x build_vim.sh \ |
| 26 | + && git clone https://github.com/vim/vim.git \ |
| 27 | + && ./build_vim.sh ${PYTHON} \ |
| 28 | + && rm -rf vim build_vim.sh |
| 29 | + |
| 30 | +ENV PYTHON_MODE_HOME /root/.vim/pack/foo/start/python-mode/ |
| 31 | +ENV VIM_RC /root/.vimrc |
| 32 | +ENV PYMODE_RC /root/.pymoderc |
| 33 | +ENV TEST_FILE /root/test.py |
| 34 | + |
| 35 | +COPY . ${PYTHON_MODE_HOME} |
| 36 | +RUN set -ex \ |
| 37 | + && cd ${PYTHON_MODE_HOME} \ |
| 38 | + && find . -type f -name '*.pyc' -delete \ |
| 39 | + && find . -type d -name '__pycache__' -delete \ |
| 40 | + && ln -s ${PYTHON_MODE_HOME}tests/utils/test.py ${TEST_FILE} \ |
| 41 | + && ln -s ${PYTHON_MODE_HOME}tests/utils/pymoderc ${PYMODE_RC} \ |
| 42 | + && ln -s ${PYTHON_MODE_HOME}tests/utils/vimrc ${VIM_RC} \ |
| 43 | + && touch /root/.vimrc.before /root/.vimrc.after |
| 44 | + |
| 45 | +RUN set -ex && vim -e -s -c ':exec ":helptags ALL" | exec ":qall!"' |
| 46 | + |
| 47 | +WORKDIR /root |
| 48 | +ENTRYPOINT ["/bin/bash"] |
0 commit comments