From b07ab4289380fb3ff48d406590c31832aa8dfa5b Mon Sep 17 00:00:00 2001 From: Justin Merrell Date: Fri, 28 Apr 2023 13:50:38 -0400 Subject: [PATCH] feat: add dev and release docker builds --- ...{CD-docker_build.yml => CD-docker_dev.yml} | 2 +- .github/workflows/CD-docker_release.yml | 24 +++++++++++++++++++ README.md | 4 ++++ 3 files changed, 29 insertions(+), 1 deletion(-) rename .github/workflows/{CD-docker_build.yml => CD-docker_dev.yml} (91%) create mode 100644 .github/workflows/CD-docker_release.yml diff --git a/.github/workflows/CD-docker_build.yml b/.github/workflows/CD-docker_dev.yml similarity index 91% rename from .github/workflows/CD-docker_build.yml rename to .github/workflows/CD-docker_dev.yml index 55d51cf..09f5099 100644 --- a/.github/workflows/CD-docker_build.yml +++ b/.github/workflows/CD-docker_dev.yml @@ -22,4 +22,4 @@ jobs: uses: docker/build-push-action@v4 with: push: true - tags: runpod/serverless-hello-world:latest + tags: runpod/serverless-hello-world:dev diff --git a/.github/workflows/CD-docker_release.yml b/.github/workflows/CD-docker_release.yml new file mode 100644 index 0000000..7a6a0df --- /dev/null +++ b/.github/workflows/CD-docker_release.yml @@ -0,0 +1,24 @@ +name: Docker Image + +on: + release: + types: [published] + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v4 + with: + push: true + tags: runpod/serverless-hello-world:${{ github.event.release.tag_name }} diff --git a/README.md b/README.md index 5c3d71b..015ea9a 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,10 @@ This repository is setup to automatically build and push a docker image to the GitHub Container Registry. You will need to add your DockerHub credentials `DOCKERHUB_USERNAME` & `DOCKERHUB_TOKEN` to the GitHub Secrets for this repository to enable this functionality. +You will need to update the `CD-docker_dev.yml` & `CD-docker_release.yml` files to include your DockerHub username and the name of the image you want to build. The `CD-docker_dev.yml` file will build the image and push it to the `dev` tag, while the `CD-docker_release.yml` file will build the image on releases and tag it with the release version. + ## Best Practices Models should be part of your docker image, this can be accomplished by either copying them into the image or downloading them during the build process. + +If using the input validation utility from the runpod python package, create a `schemas` python file where you can define the schemas, then import that file into your `handler.py` file.