From 6e50e2977a3a5f5d397784cb7f5072f3ab3a926d Mon Sep 17 00:00:00 2001 From: "Robert P. Goldman" Date: Wed, 26 Jul 2023 08:31:08 -0500 Subject: [PATCH 1/6] Dockerfile for grounder. --- Dockerfile | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..95033c2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +FROM ubuntu:22.04 +LABEL Description="Pandas Grounder" + +ENV HOME /root + +SHELL ["/bin/bash", "-c"] + +RUN apt-get update && apt-get -y --no-install-recommends install \ + build-essential \ + clang \ + cmake \ + gdb \ + git \ + wget \ + ca-certificates zip unzip gengetopt + +COPY . /pandaPIgrounder + +# Let us add some heavy dependency +RUN cd /pandaPIgrounder && \ + cd cpddl && \ + make boruvka opts bliss lpsolve && \ + make && \ + cd ../src && \ + make From 6b1972c8f459c52330ca1022e987568908e099b8 Mon Sep 17 00:00:00 2001 From: "Robert P. Goldman" Date: Wed, 26 Jul 2023 08:33:24 -0500 Subject: [PATCH 2/6] Script for using the dockerized grounder. --- pandaPIgrounder.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 pandaPIgrounder.sh diff --git a/pandaPIgrounder.sh b/pandaPIgrounder.sh new file mode 100755 index 0000000..8a8771f --- /dev/null +++ b/pandaPIgrounder.sh @@ -0,0 +1,34 @@ +#! /bin/bash + +show_help() { + echo "Usage: $(basename $0) INPUT-FILE OUTPUT-FILE" +} + + +while getopts "hu" opt; do + case "$opt" in + h|u) + show_help + exit 0 + ;; + esac +done + +if (( $# != 2 )); then + >&2 echo "Illegal number of parameters" + show_help + exit 1 +fi + +DIR=${TMPDIR}$(mktemp -d panda-grounder.XXXXXXXX) + +mkdir -p ${DIR} + +cp $1 ${DIR}/ + +input_filename=$( basename "$1" ) + +docker run -i -v ${DIR}:/io panda-pi-grounder:latest pandaPIgrounder/pandaPIgrounder /io/${input_filename} /io/output.sas + +cp ${DIR}/output.sas $2 + From 041aeb138d111f6a787b9c203e10c0b2f05688ea Mon Sep 17 00:00:00 2001 From: rpgoldman Date: Wed, 26 Jul 2023 09:01:56 -0500 Subject: [PATCH 3/6] Create docker-image.yml Take the standard GitHub action for building dockerfiles and adapt it for building generic PANDA subsystems (so that it could be copied to other repositories). --- .github/workflows/docker-image.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..3e8035d --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,21 @@ +name: Docker Image CI + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +env: + PANDA_SUBSYSTEM: pandaPIgrounder + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Build the Docker image + run: docker build . --file Dockerfile --tag ${PANDA_SUBSYSTEM}:$(date +%s) From fef9b315bfda15bc047639eb40f0e1bebc13ca85 Mon Sep 17 00:00:00 2001 From: rpgoldman Date: Wed, 26 Jul 2023 09:06:03 -0500 Subject: [PATCH 4/6] Permit manual initiation of workflow. --- .github/workflows/docker-image.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 3e8035d..5cee282 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -5,6 +5,7 @@ on: branches: [ "master" ] pull_request: branches: [ "master" ] + workflow_dispatch: env: PANDA_SUBSYSTEM: pandaPIgrounder From 3e772088356ddbea06371c38f609b95ad9ad8343 Mon Sep 17 00:00:00 2001 From: "Robert P. Goldman" Date: Fri, 18 Aug 2023 15:03:40 -0500 Subject: [PATCH 5/6] Fix Docker image name. Docker image names must be lower-case, so can't use CaMelCAsE as in the name of the binaries. --- .github/workflows/docker-image.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 5cee282..c4df690 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -9,6 +9,7 @@ on: env: PANDA_SUBSYSTEM: pandaPIgrounder + IMAGE_NAME: panda-pi-grounder jobs: @@ -19,4 +20,4 @@ jobs: steps: - uses: actions/checkout@v3 - name: Build the Docker image - run: docker build . --file Dockerfile --tag ${PANDA_SUBSYSTEM}:$(date +%s) + run: docker build . --file Dockerfile --tag ${IMAGE_NAME}:$(date +%s) From f289c5c8033785eb5845842143726d86834bc8fe Mon Sep 17 00:00:00 2001 From: "Robert P. Goldman" Date: Fri, 18 Aug 2023 15:35:08 -0500 Subject: [PATCH 6/6] Apply patches before building. --- Dockerfile | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 95033c2..3e4f452 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,10 +16,18 @@ RUN apt-get update && apt-get -y --no-install-recommends install \ COPY . /pandaPIgrounder -# Let us add some heavy dependency +RUN cd /pandaPIgrounder/cpddl && \ + git restore . && \ + cd third-party/boruvka && git restore . + +RUN cd /pandaPIgrounder/cpddl && \ + git apply ../0002-makefile.patch + RUN cd /pandaPIgrounder && \ cd cpddl && \ - make boruvka opts bliss lpsolve && \ - make && \ - cd ../src && \ + make boruvka opts bliss lpsolve + +RUN cd /pandaPIgrounder/cpddl && make + +RUN cd /pandaPIgrounder/src && \ make