Skip to content
Snippets Groups Projects
Commit da6ab112 authored by Suru Dissanaike's avatar Suru Dissanaike
Browse files

added Docker file for code analysis

parent f52bada9
Branches
Tags
No related merge requests found
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"]
#!/bin/bash
# Create user
USER_ID=${LOCAL_USER_ID:-9001}
useradd --shell /bin/bash -u $USER_ID -G sudo -o -c "" -m user
adduser --disabled-password user
export HOME=/home/user
echo "user ALL = NOPASSWD : ALL" >> /etc/sudoers
# Start supervisor
/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf -l /var/log/supervisord.log -j /var/run/supervisord.pid
[supervisord]
nodaemon=true
[program:ubusd]
command=/bin/bash -c "/usr/sbin/ubusd"
[program:rpcd]
command=/bin/bash -c "/usr/sbin/rpcd"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment