From 50dcc4e11355ddd960056bb108336a6f0a936b6f Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Sat, 9 Sep 2023 12:47:42 +0530 Subject: [PATCH 01/18] Create `docker.yml` --- .github/workflows/docker.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000000..e69de29bb2 From 0fc448013d2cf41fc985238825ef5b5ce646de9a Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Sun, 10 Sep 2023 02:58:54 +0530 Subject: [PATCH 02/18] Basic config --- .github/workflows/docker.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index e69de29bb2..c9ba896425 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -0,0 +1,11 @@ +name: Build & Push Docker Images + +on: + workflow_dispatch: + pull_request: + branches: + - main + +jobs: + pre_job: + runs-on: ubuntu-latest From 20a720a47e56ee358ae857d30f39982ceb7a1a56 Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Sun, 10 Sep 2023 03:05:06 +0530 Subject: [PATCH 03/18] Add initial Checkout step --- .github/workflows/docker.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index c9ba896425..2655007b79 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,11 +1,17 @@ name: Build & Push Docker Images on: - workflow_dispatch: - pull_request: - branches: - - main + workflow_dispatch: + pull_request: + branches: + - main jobs: - pre_job: - runs-on: ubuntu-latest + pre_job: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 From 2be1537dcbce80484cfb188ee23ba6c1c476e829 Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Sun, 10 Sep 2023 03:14:55 +0530 Subject: [PATCH 04/18] Add docker login step --- .github/workflows/docker.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 2655007b79..0a5ec20e73 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -15,3 +15,13 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + + - name: Login to DockerHub + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: List built images + run: docker images From b611dd1479ef7c1ce3b87f0d9012184cc3006564 Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Sun, 10 Sep 2023 03:32:58 +0530 Subject: [PATCH 05/18] Build & push `pybamm:latest` --- .github/workflows/docker.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 0a5ec20e73..32bc573608 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -25,3 +25,10 @@ jobs: - name: List built images run: docker images + + - name: Build and Push Docker Image (Without Solvers) + env: + IMAGE_NAME: pybamm/pybamm:latest + run: | + docker build -t $IMAGE_NAME -f scripts/Dockerfile . + docker push $IMAGE_NAME From c3991226f0dd5926c88c633d2b136596a4602e4c Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Sun, 10 Sep 2023 03:33:26 +0530 Subject: [PATCH 06/18] Build & push `pybamm:jax` --- .github/workflows/docker.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 32bc573608..1caf030b57 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -32,3 +32,11 @@ jobs: run: | docker build -t $IMAGE_NAME -f scripts/Dockerfile . docker push $IMAGE_NAME + + - name: Build and Push Docker Image (With JAX Solver) + env: + IMAGE_NAME: pybamm/pybamm:jax + ARG_NAME: JAX + run: | + docker build -t $IMAGE_NAME -f scripts/Dockerfile --build-arg $ARG_NAME=true . + docker push $IMAGE_NAME From 174db815d2b97f6e1f7849d611d1426703c2f805 Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Sun, 10 Sep 2023 03:33:54 +0530 Subject: [PATCH 07/18] Build & push `pybamm:odes` --- .github/workflows/docker.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 1caf030b57..4636385a5a 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -40,3 +40,11 @@ jobs: run: | docker build -t $IMAGE_NAME -f scripts/Dockerfile --build-arg $ARG_NAME=true . docker push $IMAGE_NAME + + - name: Build and Push Docker Image (With ODES & DAE Solver) + env: + IMAGE_NAME: pybamm/pybamm:odes + ARG_NAME: ODES + run: | + docker build -t $IMAGE_NAME -f scripts/Dockerfile --build-arg $ARG_NAME=true . + docker push $IMAGE_NAME From 835a78f8a872fa97b0bb5fa41934ce0dc80758a3 Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Sun, 10 Sep 2023 03:34:34 +0530 Subject: [PATCH 08/18] Build & push `pybamm:idaklu` --- .github/workflows/docker.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 4636385a5a..3e731fe814 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -48,3 +48,11 @@ jobs: run: | docker build -t $IMAGE_NAME -f scripts/Dockerfile --build-arg $ARG_NAME=true . docker push $IMAGE_NAME + + - name: Build and Push Docker Image (With IDAKLU Solver) + env: + IMAGE_NAME: pybamm/pybamm:idaklu + ARG_NAME: IDAKLU + run: | + docker build -t $IMAGE_NAME -f scripts/Dockerfile --build-arg $ARG_NAME=true . + docker push $IMAGE_NAME From 02f7936d3230a1b957e677a21444c3e9e7845d70 Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Sun, 10 Sep 2023 03:34:58 +0530 Subject: [PATCH 09/18] Build & push `pybamm:all` --- .github/workflows/docker.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 3e731fe814..2b5c2b764b 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -56,3 +56,11 @@ jobs: run: | docker build -t $IMAGE_NAME -f scripts/Dockerfile --build-arg $ARG_NAME=true . docker push $IMAGE_NAME + + - name: Build and Push Docker Image (With All Solvers) + env: + IMAGE_NAME: pybamm/pybamm:all + ARG_NAME: ALL + run: | + docker build -t $IMAGE_NAME -f scripts/Dockerfile --build-arg $ARG_NAME=true . + docker push $IMAGE_NAME From c15f96ffd8b8795831a79ee420b60ec1bb62be9f Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Sun, 10 Sep 2023 04:05:48 +0530 Subject: [PATCH 10/18] Point to `develop` --- .github/workflows/docker.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 2b5c2b764b..aed3fd3d53 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: pull_request: branches: - - main + - develop jobs: pre_job: @@ -13,8 +13,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Login to DockerHub if: github.event_name != 'pull_request' From 193ce5677ed5edf8cf57b52dc2788a9bdaa84b0d Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Fri, 22 Sep 2023 01:16:25 +0530 Subject: [PATCH 11/18] Login on dockerhub to test --- .github/workflows/docker.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index aed3fd3d53..478b18d541 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -15,7 +15,6 @@ jobs: uses: actions/checkout@v4 - name: Login to DockerHub - if: github.event_name != 'pull_request' uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} From f697bfe951145d35f9a236136ec91685b779ff0a Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Thu, 28 Sep 2023 14:19:18 +0530 Subject: [PATCH 12/18] Try pushing with `build-push-action` --- .github/workflows/docker.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 478b18d541..940f2cd072 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -24,11 +24,11 @@ jobs: run: docker images - name: Build and Push Docker Image (Without Solvers) - env: - IMAGE_NAME: pybamm/pybamm:latest - run: | - docker build -t $IMAGE_NAME -f scripts/Dockerfile . - docker push $IMAGE_NAME + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: latest - name: Build and Push Docker Image (With JAX Solver) env: From 0cd648ac8852c72de6ec297e7580a09da16cc7f6 Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Thu, 28 Sep 2023 14:22:10 +0530 Subject: [PATCH 13/18] Specify dockerfile path --- .github/workflows/docker.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 940f2cd072..debcf75c20 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -27,8 +27,9 @@ jobs: uses: docker/build-push-action@v5 with: context: . - push: true + file: scripts/Dockerfile tags: latest + push: true - name: Build and Push Docker Image (With JAX Solver) env: From bd740b7691e96ff71ba025cc03958325afe3f1ae Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Thu, 28 Sep 2023 14:29:38 +0530 Subject: [PATCH 14/18] Set up Docker Buildx --- .github/workflows/docker.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index debcf75c20..c6d1ba6885 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -14,8 +14,11 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to DockerHub - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} From bcf4c608e65e18b7c6723bdc3dab8032f9740819 Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Thu, 28 Sep 2023 14:36:51 +0530 Subject: [PATCH 15/18] Try name in tags --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index c6d1ba6885..ef6e25745e 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -31,7 +31,7 @@ jobs: with: context: . file: scripts/Dockerfile - tags: latest + tags: pybamm/pybamm:latest push: true - name: Build and Push Docker Image (With JAX Solver) From 6f012f73d481acec54d03041489b9309c55270a0 Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Thu, 28 Sep 2023 15:02:22 +0530 Subject: [PATCH 16/18] Push all images with `build-push-action` --- .github/workflows/docker.yml | 56 ++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index ef6e25745e..2b0cf706ae 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -35,33 +35,41 @@ jobs: push: true - name: Build and Push Docker Image (With JAX Solver) - env: - IMAGE_NAME: pybamm/pybamm:jax - ARG_NAME: JAX - run: | - docker build -t $IMAGE_NAME -f scripts/Dockerfile --build-arg $ARG_NAME=true . - docker push $IMAGE_NAME + uses: docker/build-push-action@v5 + with: + context: . + file: scripts/Dockerfile + tags: pybamm/pybamm:jax + push: true + build-args: | + JAX=true - name: Build and Push Docker Image (With ODES & DAE Solver) - env: - IMAGE_NAME: pybamm/pybamm:odes - ARG_NAME: ODES - run: | - docker build -t $IMAGE_NAME -f scripts/Dockerfile --build-arg $ARG_NAME=true . - docker push $IMAGE_NAME + uses: docker/build-push-action@v5 + with: + context: . + file: scripts/Dockerfile + tags: pybamm/pybamm:odes + push: true + build-args: | + ODES=true - name: Build and Push Docker Image (With IDAKLU Solver) - env: - IMAGE_NAME: pybamm/pybamm:idaklu - ARG_NAME: IDAKLU - run: | - docker build -t $IMAGE_NAME -f scripts/Dockerfile --build-arg $ARG_NAME=true . - docker push $IMAGE_NAME + uses: docker/build-push-action@v5 + with: + context: . + file: scripts/Dockerfile + tags: pybamm/pybamm:idaklu + push: true + build-args: | + IDAKLU=true - name: Build and Push Docker Image (With All Solvers) - env: - IMAGE_NAME: pybamm/pybamm:all - ARG_NAME: ALL - run: | - docker build -t $IMAGE_NAME -f scripts/Dockerfile --build-arg $ARG_NAME=true . - docker push $IMAGE_NAME + uses: docker/build-push-action@v5 + with: + context: . + file: scripts/Dockerfile + tags: pybamm/pybamm:latest + push: true + build-args: | + ALL=true From cfc2a378ee91e40f31e75222e2fc6edd3cb09071 Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Tue, 3 Oct 2023 20:28:04 +0530 Subject: [PATCH 17/18] Add cron job [skip ci] --- .github/workflows/docker.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 2b0cf706ae..bb17564fa2 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -4,7 +4,11 @@ on: workflow_dispatch: pull_request: branches: - - develop + - main + + # Run everyday at 3 am UTC + schedule: + - cron: "0 3 * * *" jobs: pre_job: From 2a88dfea7853be9c0c3fcab88dbf920f333b2c90 Mon Sep 17 00:00:00 2001 From: Arjun Date: Tue, 3 Oct 2023 20:58:57 +0530 Subject: [PATCH 18/18] Push to docker on every push to develop Co-authored-by: Saransh Chopra --- .github/workflows/docker.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index bb17564fa2..c3575a50f8 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -2,13 +2,9 @@ name: Build & Push Docker Images on: workflow_dispatch: - pull_request: + push: branches: - - main - - # Run everyday at 3 am UTC - schedule: - - cron: "0 3 * * *" + - develop jobs: pre_job: