|
1 | | -FROM fedora:27 |
2 | | -ARG TASK_VERSION |
| 1 | +ARG ALPINE_VERSION=3.12 |
| 2 | +ARG PYTHON_VERSION=3 |
| 3 | +ARG TASK_VERSION=v2.5.1 |
| 4 | +ARG VIM_VERSION=v8.2.0716 |
| 5 | +ARG VIMWIKI_VERSION=master |
| 6 | + |
| 7 | + |
| 8 | +FROM python:${PYTHON_VERSION}-alpine${ALPINE_VERSION} AS build |
3 | 9 |
|
4 | | -RUN dnf update -y |
5 | | -RUN dnf install procps-ng psmisc which vim curl git gvim gcc gcc-c++ cmake make gnutls-devel libuuid-devel -y |
6 | | - |
7 | | -# Setup language environment |
8 | | -ENV LC_ALL en_US.UTF-8 |
9 | | -ENV LANG en_US.UTF-8 |
10 | | -ENV LANGUAGE en_US.UTF-8 |
11 | | - |
12 | | -# Setup taskwarrior |
13 | | -RUN git clone --recursive https://github.com/GothenburgBitFactory/taskwarrior.git task |
14 | | -WORKDIR task |
15 | | -RUN echo ${TASK_VERSION}; git checkout ${TASK_VERSION} |
16 | | -RUN git clean -dfx |
17 | | -RUN git submodule init |
18 | | -RUN git submodule update |
19 | | -RUN cmake -DCMAKE_BUILD_TYPE=release . |
20 | | -RUN make -j2 |
| 10 | + |
| 11 | +FROM build AS build-vim |
| 12 | +RUN apk add --no-cache \ |
| 13 | + gcc \ |
| 14 | + git \ |
| 15 | + gtk+3.0-dev \ |
| 16 | + libxt-dev \ |
| 17 | + make \ |
| 18 | + musl-dev \ |
| 19 | + ncurses-dev |
| 20 | +ARG VIM_VERSION |
| 21 | +RUN git clone --depth 1 --recurse-submodules --shallow-submodules \ |
| 22 | + --branch $VIM_VERSION https://github.com/vim/vim /usr/src/vim |
| 23 | +WORKDIR /usr/src/vim |
| 24 | +# "backport" https://github.com/vim/vim/commit/16d7eced1a08565a9837db8067c7b9db5ed68854 |
| 25 | +RUN sed -i -e '/#\s*undef _POSIX_THREADS/d' src/if_python3.c |
| 26 | +RUN ./configure --prefix=/opt/vim --enable-pythoninterp --enable-python3interp --enable-gui=gtk3 |
| 27 | +RUN make -j$(nproc) |
| 28 | +RUN make install |
| 29 | + |
| 30 | + |
| 31 | +FROM build AS build-taskwarrior |
| 32 | +RUN apk add --no-cache \ |
| 33 | + cmake \ |
| 34 | + g++ \ |
| 35 | + gcc \ |
| 36 | + git \ |
| 37 | + make \ |
| 38 | + util-linux-dev |
| 39 | +ARG TASK_VERSION |
| 40 | +RUN git clone --depth 1 --recurse-submodules --shallow-submodules \ |
| 41 | + --branch $TASK_VERSION https://github.com/GothenburgBitFactory/taskwarrior /usr/src/taskwarrior |
| 42 | +WORKDIR /usr/src/taskwarrior |
| 43 | +RUN cmake -DCMAKE_INSTALL_PREFIX=/opt/taskwarrior -DCMAKE_BUILD_TYPE=release -DENABLE_SYNC=OFF . |
| 44 | +RUN make -j$(nproc) |
21 | 45 | RUN make install |
22 | | -RUN task --version |
23 | | - |
24 | | -# Setup vimwiki |
25 | | -RUN mkdir -p /root/.vim/bundle /root/.vim/autoload |
26 | | -RUN curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim |
27 | | -RUN cd /root/.vim/bundle; git clone https://github.com/vimwiki/vimwiki.git |
28 | | -RUN cd /root/.vim/bundle/vimwiki/; git checkout dev |
29 | | - |
30 | | -# Setup taskwiki |
31 | | -RUN pip3 install nose pytest coveralls coverage vimrunner |
32 | | -ADD requirements.txt requirements.txt |
33 | | -RUN pip3 install -r requirements.txt |
34 | | -RUN mkdir /root/.vim/bundle/taskwiki |
35 | | -WORKDIR /root/.vim/bundle/taskwiki |
36 | 46 |
|
37 | | -CMD ["sh", "-c", "python3 -m pytest -vv tests/"] |
| 47 | + |
| 48 | +FROM build AS build-pip |
| 49 | +# coverage needs to build a C extensions, otherwise it's slow |
| 50 | +RUN apk add --no-cache \ |
| 51 | + gcc \ |
| 52 | + linux-headers \ |
| 53 | + musl-dev |
| 54 | +RUN pip install --root=/opt/pip-root \ |
| 55 | + coverage \ |
| 56 | + coveralls \ |
| 57 | + pytest \ |
| 58 | + pytest-cov \ |
| 59 | + pytest-xdist \ |
| 60 | + https://github.com/liskin/vimrunner-python/archive/8c19ff88050c09236e7519425bfae33c687483df.zip |
| 61 | +COPY requirements.txt /tmp/taskwiki/requirements.txt |
| 62 | +RUN pip install --root=/opt/pip-root \ |
| 63 | + -r /tmp/taskwiki/requirements.txt |
| 64 | + |
| 65 | + |
| 66 | +FROM build AS tests |
| 67 | +RUN apk add --no-cache \ |
| 68 | + git \ |
| 69 | + make \ |
| 70 | + patchelf \ |
| 71 | + tzdata \ |
| 72 | + xvfb-run |
| 73 | +RUN ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime |
| 74 | + |
| 75 | +COPY --from=build-vim /opt/vim/ /opt/vim/ |
| 76 | +COPY --from=build-taskwarrior /opt/taskwarrior/ /opt/taskwarrior/ |
| 77 | +COPY --from=build-pip /opt/pip-root/ / |
| 78 | + |
| 79 | +# install runtime deps of vim/taskwarrior |
| 80 | +RUN patchelf --print-needed /opt/*/bin/* \ |
| 81 | + | grep -v '^libpython' \ |
| 82 | + | sort -u \ |
| 83 | + | sed -e 's/^/so:/' \ |
| 84 | + | xargs -rt apk add --no-cache |
| 85 | +ENV PATH=/opt/vim/bin:/opt/taskwarrior/bin:$PATH |
| 86 | +RUN task --version && vim --version |
| 87 | + |
| 88 | +ARG VIMWIKI_VERSION |
| 89 | +RUN git clone --depth 1 --recurse-submodules --shallow-submodules \ |
| 90 | + --branch $VIMWIKI_VERSION https://github.com/vimwiki/vimwiki /root/.vim/bundle/vimwiki |
| 91 | + |
| 92 | +WORKDIR /root/.vim/bundle/taskwiki |
0 commit comments