Skip to content

Commit ad0b827

Browse files
committed
Add support for running CBMC in a Docker container.
Add a Dockerfile that allows CBMC to be built and run in a Docker container. The Dockerfile is setup in a way that allows multi-stage builds, so that it's built in one container, and then the build artifacts are being copied in another.
1 parent c50c69d commit ad0b827

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM ubuntu:20.04 as builder
2+
ENV DEBIAN_FRONTEND noninteractive
3+
ENV DEBCONF_NONINTERACTIVE_SEEN true
4+
# Timezone data is needed during the installation of dependencies,
5+
# since cmake depends on the tzdata package. In an interactive terminal,
6+
# the user selects the timezone at installation time. Since this needs
7+
# to be a non-interactive terminal, we need to setup some sort of default.
8+
# The UTC one seemed the most suitable one.
9+
RUN echo 'tzdata tzdata/Areas select Etc' | debconf-set-selections; \
10+
echo 'tzdata tzdata/Zones/Etc select UTC' | debconf-set-selections; \
11+
apt-get update && apt-get upgrade -y && apt-get install --no-install-recommends -y \
12+
cmake \
13+
ninja-build \
14+
gcc \
15+
g++ \
16+
maven \
17+
flex \
18+
bison \
19+
libxml2-utils \
20+
dpkg-dev
21+
COPY . /tmp/cbmc
22+
WORKDIR /tmp/cbmc
23+
RUN cmake -S . -Bbuild -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ && cd build; ninja -j2
24+
25+
FROM ubuntu:20.04 as runner
26+
COPY --from=builder /tmp/cbmc/build/bin/* /usr/local/bin/
27+
RUN apt-get update && apt-get install -y gcc

0 commit comments

Comments
 (0)