freesasa-sys 0.1.11

Rust raw FFI bindings for the freesasa C library
FROM ubuntu:18.04

LABEL maintainer="Oliver Wissett"
LABEL version="1.0"
LABEL description="FreeSASA dev container including Rust"

ARG USERNAME=sasa
ARG USER_UID=1000
ARG USER_GID=${USER_UID}

ARG DEBIAN_FRONTEND=noninteractive

# Install core packages
RUN apt-get update && apt-get install -y \
    git \
    make \
    pkg-config \
    build-essential \
    autoconf \
    libc++-dev \
    libc++abi-dev \
    libjson-c-dev \
    libxml2-dev \
    libxml2-utils \
    check \
    zsh \
    curl \
    vim \
    nano \
    sudo \
    wget \
    libclang-dev \
    clang \
    linux-tools-generic \
    python3-pip \
    gnuplot

# Install rust tool chain
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y

# Install oh-my-zsh on root
RUN bash -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
RUN git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

RUN mv /root/.oh-my-zsh /usr/share/oh-my-zsh
WORKDIR /usr/share/oh-my-zsh
RUN cp ./templates/zshrc.zsh-template zshrc

# Patch the zshrc file
RUN sed -i 's/plugins=(git)/plugins=(git zsh-syntax-highlighting)/g' ./zshrc \
    && wget https://aur.archlinux.org/cgit/aur.git/plain/0001-zshrc.patch\?h\=oh-my-zsh-git -O zshrc.patch && patch -p1 < zshrc.patch

RUN echo 'source $HOME/.cargo/env' >> ./zshrc
RUN echo 'alias perf=/usr/lib/linux-tools/4.15.0-201-generic/perf' >> ./zshrc

RUN cp ./zshrc /root/.zshrc
RUN sudo ln /usr/share/oh-my-zsh/zshrc /etc/skel/.zshrc

RUN groupadd --gid $USER_GID $USERNAME \
    && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
    && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
    && chmod 0440 /etc/sudoers.d/$USERNAME \
    && chown -R $USERNAME:$USERNAME /home/$USERNAME \
    && chsh -s $(which zsh) ${USERNAME}


# Install syntax highlighting
WORKDIR /home/sasa

# Install rust tool chain
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y

RUN git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
RUN sed -i 's/plugins=(git)/plugins=(git zsh-syntax-highlighting)/g' ~/.zshrc

RUN git clone https://github.com/mittinatten/freesasa.git
WORKDIR /home/${USERNAME}/freesasa
RUN git submodule init
RUN git submodule update
RUN autoreconf -i
RUN ./configure CFLAGS="-Ofast" --disable-json --disable-xml
RUN make
RUN make install

ARG DEBIAN_FRONTEND=dialog
USER ${USERNAME}

# Install rust tool chain
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y

# Install pre-commit
RUN pip3 install pre-commit
RUN echo 'export PATH=/home/sasa/.local/bin:$PATH' >> $HOME/.zshrc