From 4a668bbf2d656c1bc28372075bad9bb92cae20c5 Mon Sep 17 00:00:00 2001 From: joachimbbp <104856283+joachimbbp@users.noreply.github.com> Date: Thu, 5 Sep 2024 17:51:38 -0400 Subject: [PATCH 1/9] github action testing --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 4800acd..cd2cc6d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,3 +37,5 @@ RUN python3 -m venv .venv && \ ENV PYTHONPATH="/openvdb/build/openvdb/openvdb/python" ENTRYPOINT [ "sleep", "infinity" ] + +#Comment added to test github actions \ No newline at end of file From 1bcd756538948b9c481346b8d2d95dc5ad4d21d6 Mon Sep 17 00:00:00 2001 From: joachimbbp <104856283+joachimbbp@users.noreply.github.com> Date: Thu, 5 Sep 2024 17:54:01 -0400 Subject: [PATCH 2/9] Perhaps this calls the build action itself --- .github/workflows/build.yaml | 4 ++++ Dockerfile | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c89adb6..23efa22 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -22,4 +22,8 @@ jobs: - run: echo "๐Ÿšœ Running Docker Image..." - name: Build Docker Image run: docker build -t my-image:latest . + + - name: build + run: make build + - run: echo "๐Ÿ all steps complete" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index cd2cc6d..4e3754f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,4 +38,4 @@ ENV PYTHONPATH="/openvdb/build/openvdb/openvdb/python" ENTRYPOINT [ "sleep", "infinity" ] -#Comment added to test github actions \ No newline at end of file +#Comment added to test github actions 1 \ No newline at end of file From 1e2be99f58d40bcbca0651b86cb67cd01cd63cf7 Mon Sep 17 00:00:00 2001 From: joachimbbp <104856283+joachimbbp@users.noreply.github.com> Date: Thu, 5 Sep 2024 17:55:53 -0400 Subject: [PATCH 3/9] Removed funky recursive make --- .github/workflows/build.yaml | 4 ++-- Dockerfile | 2 +- README.md | 26 +------------------------- 3 files changed, 4 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 23efa22..443b2ed 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -23,7 +23,7 @@ jobs: - name: Build Docker Image run: docker build -t my-image:latest . - - name: build - run: make build +# - name: build +# run: make build - run: echo "๐Ÿ all steps complete" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 4e3754f..7e956b1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,4 +38,4 @@ ENV PYTHONPATH="/openvdb/build/openvdb/openvdb/python" ENTRYPOINT [ "sleep", "infinity" ] -#Comment added to test github actions 1 \ No newline at end of file +#Comment added to test github actions 2 \ No newline at end of file diff --git a/README.md b/README.md index 260328c..170d99f 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,2 @@ # Info -This project is a Dockerfile for [OpenVDB](https://www.openvdb.org/) with `NumPy` support. It is used in [Neurovolume](https://github.com/joachimbbp/neurovolume) but should also be applicable to many scientific visualization projects. - -It was made by [Zach Lipp](https://github.com/zachlipp) and Joachim Pfefferkorn (but mostly Zach) at the [Recurse Center](https://www.recurse.com/) - -# To Do -## Dev and Build -- [ ] Configure the Dev Container with Python -- [ ] Learn how to not copy Dev Container directories -- [ ] Multistage Build -- [ ] Docker Compose File for developer experience -- [ ] Install VScode Python extension -- [ ] Install Jupyter Python extension -## Dependencies -- [x] Install all other dependencies with docker container - - [x] Pin their versions - - [x] Move Jupyter dependency from global install to a simple Python dependency - - [x] Figure out a DRYer and less verbose `pipx` installation technique - - [x] Install `nilearn` in neurovolume_deps.txt` -- [x] Pin "system dependencies" -- [x] Figure out a good naming difference between these two and name their respective `.txt` files accordingly - - Created a 'neurovolume_deps.txt' specifically for [neurovolume](https://github.com/joachimbbp/neurovolume). This allows other projects to easily swap out their own dependencies. -## Github Actions -- [ ] Test the github actions -- [ ] Lock action versions (`checkout@v4` etc ) -- [ ] Cache and/or retain the Docker image (either by integrating into dockerhub or by github action log retention) \ No newline at end of file +Branch for github action testing only. \ No newline at end of file From f4cc8f1fe3776d2023618146697135db9f1f07b3 Mon Sep 17 00:00:00 2001 From: joachimbbp <104856283+joachimbbp@users.noreply.github.com> Date: Sat, 7 Sep 2024 16:58:41 -0400 Subject: [PATCH 4/9] Docker tag updated, changed to run only when pushed to main --- .github/workflows/build.yaml | 20 +++++++++++++------- Dockerfile | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 443b2ed..4f208bd 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,6 +1,8 @@ name: Build on: - pull_request: + push: + branches: + - 'main' paths: - Dockerfile jobs: @@ -9,7 +11,7 @@ jobs: steps: - run: echo "๐Ÿ‹ Dockerfile change detected by a ${{github.event_name}} event!" - run: echo "๐Ÿงช This job, running on ${{runner.os}}, will test to see if the dockerfile can succesfully build an image" - - run: echo "๐ŸŒณ Just so you know, this is running on the ${{github.ref}} branch of ${{github.repository}}" + - run: echo "๐ŸŒณ This is running on the ${{github.ref}} branch of ${{github.repository}}" - name: Check Out uses: actions/checkout@v4 @@ -19,11 +21,15 @@ jobs: - name: Setup Docker Buildx uses: docker/setup-buildx-action@v3 - - run: echo "๐Ÿšœ Running Docker Image..." - - name: Build Docker Image - run: docker build -t my-image:latest . + - name: Sanitize PR Title to Create Docker Image Tag + id: sanitize + run: echo "title=$(echo ${{ github.event.head_commit.message }} | tr -cs '[:alnum:]' '-')" >> $GITHUB_OUTPUT -# - name: build -# run: make build + - name: Create Set Docker Tag + run: echo "SANITIZED_TITLE=${{ steps.sanitize.outputs.title }}" >> $GITHUB_ENV + + - run: echo "๐Ÿšœ Building docker image ${{env.SANITIZED_TITLE}}" + - name: Build Docker Image + run: docker build -t "${{env.SANITIZED_TITLE}}" . - run: echo "๐Ÿ all steps complete" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 7e956b1..a655fc8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,4 +38,4 @@ ENV PYTHONPATH="/openvdb/build/openvdb/openvdb/python" ENTRYPOINT [ "sleep", "infinity" ] -#Comment added to test github actions 2 \ No newline at end of file +#Comment added to test github actions 3 \ No newline at end of file From 3fb638e3fb117e9344740c150b924a62e2b8cb42 Mon Sep 17 00:00:00 2001 From: joachimbbp <104856283+joachimbbp@users.noreply.github.com> Date: Wed, 11 Sep 2024 17:24:32 -0400 Subject: [PATCH 5/9] build_and_push separated --- .github/workflows/build_and_push.yaml | 41 +++++++++++++++++++++++++++ .github/workflows/build_only.yaml | 29 +++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 .github/workflows/build_and_push.yaml create mode 100644 .github/workflows/build_only.yaml diff --git a/.github/workflows/build_and_push.yaml b/.github/workflows/build_and_push.yaml new file mode 100644 index 0000000..307bbb1 --- /dev/null +++ b/.github/workflows/build_and_push.yaml @@ -0,0 +1,41 @@ +#TODO trigger when build finishes +name: Build And Push +on: + # push: + # branches: + # - 'main' + # paths: + # - Dockerfile + workflow_dispatch + +jobs: + docker: + runs-on: ubuntu-latest + steps: + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PW }} + + - name: Set up QEMU #might not be needed + uses: docker/setup-qemu-action@v3 + + - name: Check Out + uses: actions/checkout@v4 + - run: echo "๐Ÿƒโ€โžก๏ธ ${{ github.repository }} has been cloned to ${{ runner.name }}" + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + env: + DATETIME: "$(date +'%Y%m%d%H%M%S')" + - name: Set Image Tag #TODO get rid of this echo hack, put it directly in the variable + run: echo "IMAGE_TAG=openvdb${{ env.DATETIME }}" >> $GITHUB_ENV + + - name: Build and Push to Dockerhub + uses: docker/build-push-action@v6 + with: + push: true + tags: ${{ env.IMAGE_TAG }} #user/app:latest \ No newline at end of file diff --git a/.github/workflows/build_only.yaml b/.github/workflows/build_only.yaml new file mode 100644 index 0000000..0612b9f --- /dev/null +++ b/.github/workflows/build_only.yaml @@ -0,0 +1,29 @@ +name: Build Only +on: workflow_dispatch +jobs: + build: + runs-on: ubuntu-latest + steps: + - run: echo "๐Ÿ‹ Dockerfile change detected by a ${{ github.event_name }} event!" + - run: echo "๐Ÿงช This job, running on ${{ runner.os }}, will test to see if the dockerfile can successfully build an image" + - run: echo "๐ŸŒณ This is running on the ${{ github.ref }} branch of ${{ github.repository }}" + + - name: Check Out + uses: actions/checkout@v4 + - run: echo "๐Ÿƒโ€โžก๏ธ ${{ github.repository }} has been cloned to ${{ runner.name }}" + + - run: echo "๐Ÿ—๏ธ Setting up Docker Buildx..." + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v3 + + env: + DATETIME: "$(date +'%Y%m%d%H%M%S')" + - name: Set Image Tag #TODO get rid of this echo hack, put it directly in the variable + run: echo "IMAGE_TAG=openvdb${{ env.DATETIME }}" >> $GITHUB_ENV + + + - run: echo "๐Ÿšœ Building docker image ${{ env.IMAGE_TAG }}" + - name: Build Docker Image + run: docker build -t "${{ env.IMAGE_TAG }}" . + + - run: echo "๐Ÿ all steps complete" \ No newline at end of file From 58f22827bef085b8f7e84c6af3ebc4069c18d3a8 Mon Sep 17 00:00:00 2001 From: Joachim Pfefferkorn <104856283+joachimbbp@users.noreply.github.com> Date: Wed, 11 Sep 2024 18:31:22 -0400 Subject: [PATCH 6/9] Update build_and_push.yaml Moving this back onto the specific branch as to not spam main --- .github/workflows/build_and_push.yaml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_and_push.yaml b/.github/workflows/build_and_push.yaml index 307bbb1..61ae7a7 100644 --- a/.github/workflows/build_and_push.yaml +++ b/.github/workflows/build_and_push.yaml @@ -1,4 +1,6 @@ -#TODO trigger when build finishes +#READ THIS: +#this file is on main only to test github actions. it is a WIP + name: Build And Push on: # push: @@ -11,8 +13,12 @@ on: jobs: docker: runs-on: ubuntu-latest + environment: docker_jbbp steps: - + + - name: Verify Secrets + run: echo "Username is set to ${{ secrets.DOCKERHUB_USERNAME }}" + - name: Login to Docker Hub uses: docker/login-action@v3 with: @@ -38,4 +44,4 @@ jobs: uses: docker/build-push-action@v6 with: push: true - tags: ${{ env.IMAGE_TAG }} #user/app:latest \ No newline at end of file + tags: ${{ env.IMAGE_TAG }} #user/app:latest From ee31ad16eb219ec72e1e7ffb47c95ea43b19bf79 Mon Sep 17 00:00:00 2001 From: joachimbbp <104856283+joachimbbp@users.noreply.github.com> Date: Thu, 12 Sep 2024 11:01:11 -0400 Subject: [PATCH 7/9] PW switched out for TOKEN --- .github/workflows/build_and_push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_push.yaml b/.github/workflows/build_and_push.yaml index 61ae7a7..12824e5 100644 --- a/.github/workflows/build_and_push.yaml +++ b/.github/workflows/build_and_push.yaml @@ -23,7 +23,7 @@ jobs: uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PW }} + password: ${{ secrets.DOCKER_TOKEN }} - name: Set up QEMU #might not be needed uses: docker/setup-qemu-action@v3 From c287d337dabea4c338c0c9da070c7860dd643a0b Mon Sep 17 00:00:00 2001 From: joachimbbp <104856283+joachimbbp@users.noreply.github.com> Date: Thu, 12 Sep 2024 12:50:42 -0400 Subject: [PATCH 8/9] repository added --- .github/workflows/build_and_push.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_and_push.yaml b/.github/workflows/build_and_push.yaml index 12824e5..7d52245 100644 --- a/.github/workflows/build_and_push.yaml +++ b/.github/workflows/build_and_push.yaml @@ -43,5 +43,7 @@ jobs: - name: Build and Push to Dockerhub uses: docker/build-push-action@v6 with: + context: . push: true - tags: ${{ env.IMAGE_TAG }} #user/app:latest + tags: ${{ env.IMAGE_TAG }} + repository: ${{ secrets.DOCKERHUB_USERNAME }}/openvdb From 9876be7cf9ea6885c091e717d9c3b3eb879987c0 Mon Sep 17 00:00:00 2001 From: joachimbbp <104856283+joachimbbp@users.noreply.github.com> Date: Wed, 18 Sep 2024 13:53:02 -0400 Subject: [PATCH 9/9] repository path baked into image tag --- .github/workflows/build_and_push.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_and_push.yaml b/.github/workflows/build_and_push.yaml index 7d52245..deca59b 100644 --- a/.github/workflows/build_and_push.yaml +++ b/.github/workflows/build_and_push.yaml @@ -30,7 +30,6 @@ jobs: - name: Check Out uses: actions/checkout@v4 - - run: echo "๐Ÿƒโ€โžก๏ธ ${{ github.repository }} has been cloned to ${{ runner.name }}" - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -38,12 +37,11 @@ jobs: env: DATETIME: "$(date +'%Y%m%d%H%M%S')" - name: Set Image Tag #TODO get rid of this echo hack, put it directly in the variable - run: echo "IMAGE_TAG=openvdb${{ env.DATETIME }}" >> $GITHUB_ENV + run: echo "IMAGE_TAG=joachimbbp/openvdb:openvdb_${{ env.DATETIME }}" >> $GITHUB_ENV - name: Build and Push to Dockerhub uses: docker/build-push-action@v6 with: context: . push: true - tags: ${{ env.IMAGE_TAG }} - repository: ${{ secrets.DOCKERHUB_USERNAME }}/openvdb + tags: ${{ env.IMAGE_TAG }} \ No newline at end of file