about summary refs log tree commit diff homepage
path: root/Dockerfile
diff options
context:
space:
mode:
authorMartin Nowack <m.nowack@imperial.ac.uk>2022-06-20 13:55:34 +0100
committerCristian Cadar <c.cadar@imperial.ac.uk>2022-06-20 17:42:07 +0100
commit19f40fefaba602d1db2e26ad77df1a85a1a69c21 (patch)
tree517cf58d79c5bec9bfb6a951f04ed71da81d5b51 /Dockerfile
parent790dd728a67b36e3006f83d89fd6fef357bc3868 (diff)
downloadklee-19f40fefaba602d1db2e26ad77df1a85a1a69c21.tar.gz
Use `klee` user to install system dependencies
As a follow-up to recent build script enhancements
(https://github.com/klee/klee/commit/818275b7249250780ddd5ed021cae64288514270),
finally build KLEE inside of the Docker image as artefact owned by the
`klee` user, including user-installed Python3 modules.

This fixes issues with non-writable build directories.

In addition `$HOME/.local/bin` directory is made available in search path.
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile18
1 files changed, 8 insertions, 10 deletions
diff --git a/Dockerfile b/Dockerfile
index 567dd63d..6926b133 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -47,25 +47,23 @@ RUN apt update && DEBIAN_FRONTEND=noninteractive apt -y --no-install-recommends
 # Copy across source files needed for build
 COPY --chown=klee:klee . /tmp/klee_src/
 
+USER klee
+WORKDIR /home/klee
 # Build and set klee user to be owner
-RUN /tmp/klee_src/scripts/build/build.sh --debug --install-system-deps klee && chown -R klee:klee /tmp/klee_build* && pip3 install flask wllvm && \
-    rm -rf /var/lib/apt/lists/*
+RUN /tmp/klee_src/scripts/build/build.sh --debug --install-system-deps klee && pip3 install flask wllvm && \
+    sudo rm -rf /var/lib/apt/lists/*
 
-# Install tabulate for klee-stats
-RUN pip3 install tabulate
 
-ENV PATH="$PATH:/tmp/llvm-110-install_O_D_A/bin:/home/klee/klee_build/bin"
+ENV PATH="$PATH:/tmp/llvm-110-install_O_D_A/bin:/home/klee/klee_build/bin:/home/klee/.local/bin"
 ENV BASE=/tmp
 
 # Add KLEE header files to system standard include folder
-RUN /bin/bash -c 'ln -s ${BASE}/klee_src/include/klee /usr/include/'
+RUN sudo /bin/bash -c 'ln -s /tmp/klee_src/include/klee /usr/include/'
 
-USER klee
-WORKDIR /home/klee
 ENV LD_LIBRARY_PATH /home/klee/klee_build/lib/
 
 # Add KLEE binary directory to PATH
-RUN /bin/bash -c 'ln -s ${BASE}/klee_src /home/klee/ && ln -s ${BASE}/klee_build* /home/klee/klee_build' 
+RUN /bin/bash -c 'ln -s ${BASE}/klee_src /home/klee/ && ln -s ${BASE}/klee_build* /home/klee/klee_build'
 
 # TODO Remove when STP is fixed
-RUN /bin/bash -c 'echo "export LD_LIBRARY_PATH=$(cd ${BASE}/metaSMT-*-deps/stp-git-basic/lib/ && pwd):$LD_LIBRARY_PATH" >> /home/klee/.bashrc'
+RUN /bin/bash -c 'echo "export LD_LIBRARY_PATH=$(cd ${BASE}/metaSMT-*-deps/stp-git-basic/lib/ && pwd):$LD_LIBRARY_PATH" >> /home/klee/.bashrc'
\ No newline at end of file