|
| 1 | +# Dockerfile for containers to perform PR review in |
| 2 | +# Use with make as follows: make PR=1234 review |
| 3 | + |
| 4 | +FROM centos:8 |
| 5 | + |
| 6 | +# Workaround to the location of the repos |
| 7 | +RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* |
| 8 | +RUN sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* |
| 9 | + |
| 10 | +RUN dnf update -y |
| 11 | +RUN yum install epel-release -y |
| 12 | +RUN dnf install python38 git gcc gcc-c++ cmake make libuuid-devel libfaketime sudo man -y |
| 13 | + |
| 14 | +RUN useradd warrior |
| 15 | +RUN echo warrior ALL=NOPASSWD:ALL > /etc/sudoers.d/warrior |
| 16 | + |
| 17 | +USER warrior |
| 18 | +WORKDIR /home/warrior/ |
| 19 | + |
| 20 | +# Setup Rust |
| 21 | +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh && \ |
| 22 | + sh rustup.sh -y --profile minimal --default-toolchain stable --component rust-docs |
| 23 | + |
| 24 | +# Setup taskwarrior |
| 25 | +# The purpose is to speed up subsequent re-installs due to Docker layer caching |
| 26 | +RUN git clone https://github.com/GothenburgBitFactory/taskwarrior.git |
| 27 | +WORKDIR /home/warrior/taskwarrior/ |
| 28 | +RUN git submodule init |
| 29 | +RUN git submodule update |
| 30 | +RUN cmake -DCMAKE_BUILD_TYPE=debug . |
| 31 | +RUN make -j8 |
| 32 | +RUN sudo make install |
| 33 | + |
| 34 | +# Use specified PR's branch, if provided |
| 35 | +ARG PR |
| 36 | +RUN if [[ ! -z $PR ]]; then \ |
| 37 | + git fetch origin refs/pull/${PR}/head:pr-${PR}; \ |
| 38 | + git checkout pr-${PR}; fi |
| 39 | + |
| 40 | +# Use specified libshared PR's branch, if provided |
| 41 | +ARG LIBPR |
| 42 | +WORKDIR /home/warrior/taskwarrior/src/libshared/ |
| 43 | +RUN if [[ ! -z $LIBPR ]]; then \ |
| 44 | + git fetch origin refs/pull/${LIBPR}/head:libpr-${LIBPR}; \ |
| 45 | + git checkout libpr-${LIBPR}; fi |
| 46 | + |
| 47 | +# Install taskwarrior |
| 48 | +WORKDIR /home/warrior/taskwarrior/ |
| 49 | +RUN cmake -DCMAKE_BUILD_TYPE=debug . |
| 50 | +RUN make -j8 |
| 51 | +RUN sudo make install |
| 52 | + |
| 53 | +WORKDIR /home/warrior |
| 54 | +RUN task rc.confirmation=0 _ids || : # Generate default taskrc |
0 commit comments