Skip to content
Snippets Groups Projects
Dockerfile 3.16 KiB
FROM ubuntu:18.04

LABEL maintainer="suru.dissanaike@iopsys.eu"
LABEL build="docker build -t iopsys-codeanalysis ."
LABEL run="docker run -d --name codeanalysis --rm -v ${PWD}:/opt/work -e LOCAL_USER_ID=`id -u $USER` iopsys-codeanalysis"
LABEL exec="docker exec --user=user -it codeanalysis bash"


RUN \
      apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
      # general tools
      git \
      cmake \
      wget \
      build-essential \
      lcov \
      apt-utils \
      autoconf \
      automake \
      pkg-config \
      libtool \
      vim \
      valgrind \
      gdb \
      clang-format \
      sudo \
      strace \
      supervisor \
      net-tools \
      iputils-ping


# Install dependent libraries
RUN \
      apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
      lua5.1-dev \
      lua5.1 \
      libssl-dev \
      libuv1-dev \
      cmocka-doc \
      libcmocka-dev \
      libcmocka0



# Remove cached packages.
RUN rm -rf /var/lib/apt/lists/*

RUN mkdir /opt/dev

# Install JSON-C
RUN \
      cd /opt/dev && \
      git clone https://github.com/json-c/json-c.git && \
      cd json-c && \
      sh autogen.sh && \
      ./configure && \
      make && \
      make install && \
      sudo ldconfig

# ubox
RUN \
      cd /opt/dev && \
      git clone  git://git.openwrt.org/project/libubox.git && \
      cd libubox && mkdir build && cd build && \
      git checkout fd57eea9f37e447814afbf934db626288aac23c4 && \
      cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE:String="Release" .. && \
      make -j2 && \
      make install

# uci
RUN \
      cd /opt/dev && \
      git clone git://nbd.name/uci.git && \
      cd uci && \
      git checkout a536e300370cc3ad7b14b052b9ee943e6149ba4d && \
      cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE:String="Release" -DBUILD_LUA=OFF . && \
      make -j2 && \
      make install

# ubus
RUN \
      cd /opt/dev && \
      git clone https://git.openwrt.org/project/ubus.git && \
      cd ubus && \
      git checkout 5f87f5480ebf004d735dbf44259d08cf8affd305 && \
      cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE:String="Release" -DBUILD_LUA=OFF -DBUILD_EXAMPLES=OFF . && \
      make -j2 && \
      make install

# rpcd
RUN \
      cd /opt/dev && \
      git clone https://git.openwrt.org/project/rpcd.git && \
      cd rpcd && \
      git checkout cfe1e75c91bc1bac82e6caab3e652b0ebee59524 && \
      cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE:String="Release" -DIWINFO_SUPPORT=NO . && \
      make -j2 && \
      make install && \
      mkdir /usr/lib/rpcd && \
      cp file.so /usr/lib/rpcd


# json-editor
RUN \
      cd /opt/dev && \
      git clone https://dev.iopsys.eu/iopsys/json-editor.git && \
      cd json-editor && \
      git checkout 44b32937a062ec4ffc9f7355841dc94ab6efa50f && \
      cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE:String="Release" . && \
      make && \
      make install


RUN mkdir /etc/config

WORKDIR /opt/work

# Prepare supervisor
RUN mkdir -p /var/log/supervisor
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf

# Start entrypoint
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]