diff --git a/.github/workflows/build_and_push_docker.yml b/.github/workflows/build_and_push_docker.yml new file mode 100644 index 0000000000..54385ce8a6 --- /dev/null +++ b/.github/workflows/build_and_push_docker.yml @@ -0,0 +1,50 @@ +name: Build And Push Docker Image + +on: + workflow_dispatch: + inputs: + version: + description: 'The version of SCIPOptSuite like #.#.#' + required: true + type: number + +env: + IMAGE_NAME: scipoptsuite + REPOSITORY_NAME: 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: ${{ env.REPOSITORY_NAME }}/${{ env.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 new file mode 100644 index 0000000000..7b746c7bd2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM debian:bullseye-slim + +ARG DEBIAN_FRONTEND=noninteractive +ARG TARGETPLATFORM +ARG TAG + +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