diff --git a/.github/workflows/pull-request-checks.yaml b/.github/workflows/pull-request-checks.yaml index 741fc58f9d1..ad522d2c2d6 100644 --- a/.github/workflows/pull-request-checks.yaml +++ b/.github/workflows/pull-request-checks.yaml @@ -1014,8 +1014,14 @@ jobs: run: | sudo apt update sudo apt install openjdk-11-jdk-headless + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v4 - name: Build docker image - run: docker build -t cbmc . + run: | + docker buildx build \ + --cache-from type=gha \ + --cache-to type=gha,mode=max \ + --load -t cbmc . - name: Smoke test goto-cc run: docker run -v ${PWD}/.github/workflows/smoke_test_assets:/mnt/smoke -t cbmc goto-cc -o /mnt/smoke/test.goto /mnt/smoke/test.c - name: Smoke test cbmc diff --git a/Dockerfile b/Dockerfile index e73e6fda280..b2fa5e7107f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ -FROM ubuntu:20.04 as builder -ENV DEBIAN_FRONTEND noninteractive -ENV DEBCONF_NONINTERACTIVE_SEEN true +FROM ubuntu:20.04 AS builder +ENV DEBIAN_FRONTEND=noninteractive +ENV DEBCONF_NONINTERACTIVE_SEEN=true # Timezone data is needed during the installation of dependencies, # since cmake depends on the tzdata package. In an interactive terminal, # the user selects the timezone at installation time. Since this needs @@ -21,8 +21,8 @@ RUN echo 'tzdata tzdata/Areas select Etc' | debconf-set-selections; \ patch COPY . /tmp/cbmc WORKDIR /tmp/cbmc -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 +RUN cmake -S . -Bbuild -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ && ninja -C build -j2 -FROM ubuntu:20.04 as runner +FROM ubuntu:20.04 AS runner COPY --from=builder /tmp/cbmc/build/bin/* /usr/local/bin/ RUN apt-get update && apt-get install -y gcc