From f1b21f9f26b67205175119ac9e1d8a5410097d81 Mon Sep 17 00:00:00 2001 From: Borys Levkovych Date: Tue, 7 Nov 2023 16:23:43 +0100 Subject: [PATCH 1/3] Create a Dockerfile --- .../workflows/build_and_publish_docker.yml | 0 Dockerfile | 20 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 .github/workflows/build_and_publish_docker.yml create mode 100644 Dockerfile diff --git a/.github/workflows/build_and_publish_docker.yml b/.github/workflows/build_and_publish_docker.yml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..aa436807c9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM debian:bullseye-slim + +ARG DEBIAN_FRONTEND=noninteractive +ARG TARGETPLATFORM +ARG TAG=8.0.4 + +RUN apt-get update && apt-get -y install \ + build-essential \ + libcliquer1 \ + gfortran \ + liblapack3 \ + libopenblas-dev \ + libgsl25 \ + libtbb2 \ + curl + +WORKDIR /tmp +RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then curl -Lo SCIPOptSuite.deb https://github.com/scipopt/scip/releases/download/$(echo "v${TAG}" | tr -d '.')/SCIPOptSuite-${TAG}-Linux-debian.deb; fi +RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then curl -Lo SCIPOptSuite.deb https://github.com/scipopt/scip/releases/download/$(echo "v${TAG}" | tr -d '.')/SCIPOptSuite-${TAG}-Linux-arm64.deb; fi +RUN dpkg -i SCIPOptSuite.deb && rm SCIPOptSuite.deb From 9109ca4522692b4b1f2249dc5fe93d8ddd9c20dd Mon Sep 17 00:00:00 2001 From: Borys Levkovych Date: Tue, 7 Nov 2023 16:54:45 +0100 Subject: [PATCH 2/3] Create workflow to build and push docker image --- .../workflows/build_and_publish_docker.yml | 0 .../workflows/build_and_release_docker.yml | 50 +++++++++++++++++++ Dockerfile | 2 +- 3 files changed, 51 insertions(+), 1 deletion(-) delete mode 100644 .github/workflows/build_and_publish_docker.yml create mode 100644 .github/workflows/build_and_release_docker.yml diff --git a/.github/workflows/build_and_publish_docker.yml b/.github/workflows/build_and_publish_docker.yml deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/.github/workflows/build_and_release_docker.yml b/.github/workflows/build_and_release_docker.yml new file mode 100644 index 0000000000..0d102bc86c --- /dev/null +++ b/.github/workflows/build_and_release_docker.yml @@ -0,0 +1,50 @@ +name: Build And Release Docker Image + +on: + workflow_dispatch: + inputs: + version: + description: 'The version of SCIPOptSuite like #.#.#' + required: true + type: number + +env: + IMAGE_NAME: testing #scipoptsuite + REPOSITORY_NAME: blevkovych #scipoptsuite + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set Docker Tags + id: metadata + uses: docker/metadata-action@v5 + with: + images: $REPOSITORY_NAME/$IMAGE_NAME + tags: | + type=raw,value=latest + type=raw,value=${{ github.event.inputs.version }} + + - name: Build and push + uses: docker/build-push-action@v3 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.metadata.outputs.tags }} + build-args: TAG=${{ github.event.inputs.version }} diff --git a/Dockerfile b/Dockerfile index aa436807c9..7b746c7bd2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM debian:bullseye-slim ARG DEBIAN_FRONTEND=noninteractive ARG TARGETPLATFORM -ARG TAG=8.0.4 +ARG TAG RUN apt-get update && apt-get -y install \ build-essential \ From 08062c72d3affe6c86f12a1d3a8a8f164d0fe52f Mon Sep 17 00:00:00 2001 From: Borys Levkovych Date: Tue, 7 Nov 2023 17:08:15 +0100 Subject: [PATCH 3/3] Properly use env --- ...d_and_release_docker.yml => build_and_push_docker.yml} | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename .github/workflows/{build_and_release_docker.yml => build_and_push_docker.yml} (86%) diff --git a/.github/workflows/build_and_release_docker.yml b/.github/workflows/build_and_push_docker.yml similarity index 86% rename from .github/workflows/build_and_release_docker.yml rename to .github/workflows/build_and_push_docker.yml index 0d102bc86c..54385ce8a6 100644 --- a/.github/workflows/build_and_release_docker.yml +++ b/.github/workflows/build_and_push_docker.yml @@ -1,4 +1,4 @@ -name: Build And Release Docker Image +name: Build And Push Docker Image on: workflow_dispatch: @@ -9,8 +9,8 @@ on: type: number env: - IMAGE_NAME: testing #scipoptsuite - REPOSITORY_NAME: blevkovych #scipoptsuite + IMAGE_NAME: scipoptsuite + REPOSITORY_NAME: scipoptsuite jobs: build: @@ -35,7 +35,7 @@ jobs: id: metadata uses: docker/metadata-action@v5 with: - images: $REPOSITORY_NAME/$IMAGE_NAME + images: ${{ env.REPOSITORY_NAME }}/${{ env.IMAGE_NAME }} tags: | type=raw,value=latest type=raw,value=${{ github.event.inputs.version }}