Skip to content

Instantly share code, notes, and snippets.

@delphinus
Last active November 26, 2018 05:20
Show Gist options
  • Select an option

  • Save delphinus/711cee6c6984d60ab1e1818a3d87ba7e to your computer and use it in GitHub Desktop.

Select an option

Save delphinus/711cee6c6984d60ab1e1818a3d87ba7e to your computer and use it in GitHub Desktop.
Dockerfile for debugging Vim
FROM centos/devtoolset-7-toolchain-centos7
USER 0
RUN yum -y install \
git \
ncurses-devel \
@'Development Tools' \
&& yum clean all -y
USER 1001
RUN git clone https://github.com/vim/vim
WORKDIR /opt/app-root/src/vim
# add patch for debugging Vim
ADD https://gist.githubusercontent.com/delphinus/1042bc0b846d64b8417d5ca75bdb112f/raw/f917523e9584501e7b5b8b567c840e62dc5fce91/vim-debug.diff vim-debug.diff
USER 0
RUN chown default:default vim-debug.diff
RUN chmod 644 vim-debug.diff
USER 1001
RUN patch -p1 < vim-debug.diff
RUN ./configure --prefix=/opt/app-root/vim
RUN make
RUN make install
ENV PATH /opt/app-root/vim/bin:$PATH
WORKDIR /opt/app-root/src
# add test C program
ADD https://gist.githubusercontent.com/delphinus/c51d1eb11e3656dc28b34b17e0881a92/raw/f7e636ec4a92835758e1466f1a1bece6d260ffab/hello.c hello.c
USER 0
RUN chown default:default hello.c
RUN chmod 644 hello.c
USER 1001
# run this docker image with this options below to enable ptrace
# https://stackoverflow.com/questions/19215177/how-to-solve-ptrace-operation-not-permitted-when-trying-to-attach-gdb-to-a-pro
# docker build -t vim-debug .
# docker run --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --security-opt apparmor=unconfined -it vim-debug /bin/bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment