Commit cf184143 by Jörg Stucke Committed by Thomas Barabosch

reduced container size (#6)

* reduced container size

* removed caching in install script

* size optimizations
parent dc62b920
# based on https://github.com/BinaryAnalysisPlatform/bap/blob/master/docker/Dockerfile # based on https://github.com/BinaryAnalysisPlatform/bap/blob/master/docker/Dockerfile
FROM phusion/baseimage:0.11 FROM phusion/baseimage:0.11
RUN apt-get -y update && install_clean \
build-essential \ RUN apt-get -y update \
curl \ && install_clean sudo \
git \ && useradd -m bap \
libx11-dev \ && echo "bap:bap" | chpasswd \
m4 \ && adduser bap sudo \
pkg-config \ && sed -i.bkp -e 's/%sudo\s\+ALL=(ALL\(:ALL\)\?)\s\+ALL/%sudo ALL=NOPASSWD:ALL/g' /etc/sudoers
python-pip \
python-setuptools \
software-properties-common \
sudo \
unzip \
wget \
binutils-multiarch \
clang \
libgmp-dev \
libzip-dev \
llvm-6.0-dev \
zlib1g-dev
RUN wget https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh && yes /usr/local/bin | sh install.sh
RUN useradd -m bap && echo "bap:bap" | chpasswd && adduser bap sudo
RUN sed -i.bkp -e \
's/%sudo\s\+ALL=(ALL\(:ALL\)\?)\s\+ALL/%sudo ALL=NOPASSWD:ALL/g' \
/etc/sudoers
USER bap USER bap
WORKDIR /home/bap WORKDIR /home/bap
ENV PATH="/home/bap/.opam/4.05.0/bin/:${PATH}"
COPY . /home/bap/cwe_checker/
RUN sudo apt-get -y update \
&& sudo install_clean \
binutils-multiarch \
build-essential \
clang \
curl \
git \
libgmp-dev \
libx11-dev \
libzip-dev \
llvm-6.0-dev \
m4 \
pkg-config \
software-properties-common \
unzip \
wget \
zlib1g-dev \
&& wget https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh \
&& yes /usr/local/bin | sudo sh install.sh \
# install Bap # install Bap
RUN opam init --auto-setup --comp=4.05.0 --disable-sandboxing --yes && opam init --auto-setup --comp=4.05.0 --disable-sandboxing --yes \
RUN git clone -b testing --single-branch https://github.com/BinaryAnalysisPlatform/opam-repository.git && git clone -b testing --depth 1 https://github.com/BinaryAnalysisPlatform/opam-repository.git \
RUN opam repo add bap opam-repository && opam update && opam repo add bap opam-repository \
RUN opam install depext --yes && opam update \
RUN OPAMJOBS=1 opam depext --install bap --yes && opam install depext --yes \
RUN pip install bap && OPAMJOBS=1 opam depext --install bap --yes \
# install CWE_Checker and dependencies # install CWE_Checker and dependencies
RUN OPAMJOBS=1 opam install yojson alcotest --yes && OPAMJOBS=1 opam install yojson alcotest --yes \
COPY . /home/bap/cwe_checker/ && sudo chown -R bap:bap /home/bap/cwe_checker \
RUN sudo chown -R bap:bap /home/bap/cwe_checker && cd /home/bap/cwe_checker/src \
ENV PATH="/home/bap/.opam/4.05.0/bin/:${PATH}" && bapbuild -r -Is checkers,utils -pkgs yojson,unix cwe_checker.plugin \
&& bapbundle install cwe_checker.plugin \
&& sudo apt-get remove -y \
build-essential \
clang \
curl \
gcc \
g++ \
git \
libgmp-dev \
libx11-dev \
libzip-dev \
llvm-6.0-dev \
unzip \
wget \
zlib1g-dev \
&& sudo apt-get -y autoremove \
&& sudo apt-get -y clean \
&& rm -rf /home/bap/.opam/4.05.0/.opam-switch/sources
WORKDIR /home/bap/cwe_checker/src WORKDIR /home/bap/cwe_checker/src
RUN bapbuild -r -Is checkers,utils -pkgs yojson,unix cwe_checker.plugin; \
bapbundle install cwe_checker.plugin;
ENTRYPOINT ["opam", "config", "exec", "--"] ENTRYPOINT ["opam", "config", "exec", "--"]
...@@ -5,6 +5,6 @@ rm -rf src/_build ...@@ -5,6 +5,6 @@ rm -rf src/_build
rm -f src/cwe_checker.plugin rm -f src/cwe_checker.plugin
echo "Building docker container" echo "Building docker container"
docker build --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy --build-arg HTTP_PROXY=$http_proxy --build-arg HTTPS_PROXY=$https_proxy -t cwe-checker . docker build --build-arg=http{,s}_proxy --build-arg=HTTP{,S}_PROXY -t cwe-checker .
exit 0 exit 0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment