Something went wrong on our end
-
Vivek Dutta authoredVivek Dutta authored
Dockerfile 7.09 KiB
FROM ubuntu:22.04
LABEL maintainer="suru.dissanaike@iopsys.eu"
LABEL build="docker build -t code-analysis ."
LABEL run="docker run -it --entrypoint /bin/bash --rm -v ${PWD}:/opt/work code-analysis"
# docker build -t code-analysis .
# docker images
# docker tag <image id> iopsys/code-analysis:0.x
# docker push iopsys/code-analysis:0.x
RUN \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
# General tools
apt-utils \
autoconf \
automake \
build-essential \
cmake \
curl \
gcovr \
gdb \
git \
iputils-ping \
lcov \
net-tools \
pkg-config \
strace \
sudo \
supervisor \
valgrind \
wget \
# Static code analysis
default-jre-headless \
flawfinder \
python3 \
python3-setuptools \
unzip \
# Dependent libraries
cmocka-doc \
libcmocka-dev \
libcmocka0 \
libcurl4-openssl-dev\
libfdt-dev \
libnfnetlink-dev \
libnl-3-dev \
libnl-genl-3-dev \
libnl-route-3-dev \
libpcre3-dev \
libssl-dev \
libtool \
libtrace-dev \
libuv1-dev \
lua5.1 \
lua5.1-dev \
zlib1g-dev \
# Dependencies for obuspa
libc-ares-dev \
libsqlite3-dev \
libz-dev \
sqlite3 \
# Dependencies for ieee1905
libpcap-dev \
clang \
clang-format \
clang-tidy \
shellcheck \
jq \
python3-pip \
cppcheck \
bear
RUN mkdir /opt/dev && \
mkdir /etc/config
RUN git config --global advice.detachedHead false
# install node
ARG NODEJS_VERSION_MAJOR=16
RUN mkdir -p /etc/apt/keyrings && \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODEJS_VERSION_MAJOR}.x nodistro main" > /etc/apt/sources.list.d/nodesource.list && \
apt-get -y update && \
apt-get install -y nodejs && \
rm -rf /var/lib/apt/lists/*
# install typescript
ARG TYPESCRIPT_VERSION=4.8.4
RUN npm install --global "typescript@${TYPESCRIPT_VERSION}"
# install yarn
ARG YARN_VERSION=1.22.19
RUN npm install --global "yarn@${YARN_VERSION}"
# install tap-junit
ARG TAP_JUNIT_VERSION=5.0.2
RUN npm install --global "tap-junit@${TAP_JUNIT_VERSION}"
# Install JSON-C
ARG JSON_C_VERSION=9021cdcdd01fc9dbcbe1f06391848c2ac915212f
RUN \
cd /opt/dev && \
git clone https://github.com/json-c/json-c.git && \
cd json-c && \
git checkout ${JSON_C_VERSION} && \
cmake . && \
make -j$(nproc) && \
make install && \
ldconfig
# libubox
ARG LIBUBOX_VERSION=75a3b870cace1171faf57bd55e5a9a2f1564f757
RUN \
cd /opt/dev && \
git clone https://git.openwrt.org/project/libubox.git && \
cd libubox && mkdir build && cd build && \
git checkout ${LIBUBOX_VERSION} && \
cmake -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_LUA=OFF -DCMAKE_BUILD_TYPE:String="Release" .. && \
make -j$(nproc) && \
make install
# uci
ARG UCI_VERSION=5781664d5087ccc4b5ab58505883231212dbedbc
RUN \
cd /opt/dev && \
git clone https://git.openwrt.org/project/uci.git && \
cd uci && \
git checkout ${UCI_VERSION} && \
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE:String="Release" -DBUILD_LUA=OFF . && \
make -j$(nproc) && \
make install
# ubus
ARG UBUS_VERSION=f787c97b34894a38b15599886cacbca01271684f
RUN \
cd /opt/dev && \
git clone https://git.openwrt.org/project/ubus.git && \
cd ubus && \
git checkout ${UBUS_VERSION} && \
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE:String="Release" -DBUILD_LUA=OFF -DBUILD_EXAMPLES=OFF . && \
make -j$(nproc) && \
make install
# rpcd
ARG RPCD_VERSION=c07ab2f91061ad64209e9aaa1fb1b77061a1af25
RUN \
cd /opt/dev && \
git clone https://git.openwrt.org/project/rpcd.git && \
cd rpcd && \
git checkout ${RPCD_VERSION} && \
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE:String="Release" -DIWINFO_SUPPORT=OFF -DUCODE_SUPPORT=OFF . && \
make -j$(nproc) && \
make install
# json-cpp
ARG JSON_CPP_VERSION=v3.11.2
RUN \
cd /opt/dev && \
git clone https://github.com/nlohmann/json.git && \
cd json && \
git checkout ${JSON_CPP_VERSION} && \
mkdir build && \
cd build && \
cmake .. && \
make -j$(nproc) && \
make install
# json-schema-validator-cpp
ARG JSON_SCHEMA_VALIDATOR_CPP_VERSION=3ec0e69a0bce7524f12a865b153b71d0d7ef2484
RUN \
cd /opt/dev && \
git clone https://github.com/pboettch/json-schema-validator.git json-schema-validator-cpp && \
cd json-schema-validator-cpp && \
git checkout ${JSON_SCHEMA_VALIDATOR_CPP_VERSION} && \
mkdir build && \
cd build && \
cmake .. -DBUILD_SHARED_LIBS=ON && \
make -j$(nproc) && \
make install && \
ldconfig
# iopsys json-schema-validator
ARG JSON_SCHEMA_VALIDATOR_VERSION=7c9a5f64963b2ebf9811fae300c238fb17463039
RUN \
cd /opt/dev && \
git clone https://dev.iopsys.eu/iopsys/json-schema-validator.git && \
cd json-schema-validator && \
git checkout ${JSON_SCHEMA_VALIDATOR_VERSION} && \
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE:String="Release" . && \
make -j$(nproc) && \
make install && \
ldconfig
# tap
ARG TAP_VERSION=4e03bef8b3ced24cc028a43ecd6916325d6bf2cb
RUN \
cd /opt/dev && \
git clone https://github.com/zorgnax/libtap.git && \
cd libtap && \
git checkout ${TAP_VERSION} && \
make -j$(nproc) && \
make install && \
ldconfig
# git ubus-api-validator
ARG UBUS_API_VALIDATOR_VERSION=cc22027ab1fe6d980b1847a88ebc7bdbef2f5de6
RUN \
cd /opt/dev && \
git clone https://dev.iopsys.eu/iopsys/ubus-api-validator.git && \
cd ubus-api-validator && \
git checkout ${UBUS_API_VALIDATOR_VERSION} && \
make -j$(nproc) && \
make install
#install cpd
ARG PMD_VERSION=6.19.0
RUN \
cd /opt/dev && \
wget -nv https://github.com/pmd/pmd/releases/download/pmd_releases%2F${PMD_VERSION}/pmd-bin-${PMD_VERSION}.zip && \
unzip pmd-bin-${PMD_VERSION}.zip && \
mv pmd-bin-${PMD_VERSION} /usr/local/pmd
# Download the Infer release
ARG INFER_VERSION=v1.2.0
RUN cd /opt/dev && \
curl -sL https://github.com/facebook/infer/releases/download/${INFER_VERSION}/infer-linux-x86_64-${INFER_VERSION}.tar.xz | tar xJ && \
mv /opt/dev/infer-linux-x86_64-$INFER_VERSION /infer
# Install infer
ENV PATH /infer/bin:${PATH}
# Install python ubus module and valgrind-ci
RUN pip3 install ubus ValgrindCI codechecker
WORKDIR /builds/iopsys/
# Prepare supervisor
RUN mkdir -p /var/log/supervisor && \
mkdir -p /etc/supervisor/conf.d/
COPY supervisord.conf /etc/supervisor/
# Prepare JSON Schemas
RUN mkdir -p /usr/share/rpcd/schemas && \
mkdir -p /usr/share/rpcd/definitions
# Copy static_code_analysis script
COPY static_code_analysis.sh /usr/local/bin/static_code_analysis.sh
# Start entrypoint
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]