From c9b7b3a240193ca962340ef6a8b478015cdefd66 Mon Sep 17 00:00:00 2001 From: Scott Davidson Date: Wed, 25 Oct 2023 15:34:21 +0100 Subject: [PATCH] Add github workflow for chart and image builds --- .github/workflows/build-push-artifacts.yml | 71 ++++++++++++++++++++++ .helmignore | 3 +- Dockerfile => images/ui-base/Dockerfile | 2 +- 3 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build-push-artifacts.yml rename Dockerfile => images/ui-base/Dockerfile (75%) diff --git a/.github/workflows/build-push-artifacts.yml b/.github/workflows/build-push-artifacts.yml new file mode 100644 index 0000000..ae8e447 --- /dev/null +++ b/.github/workflows/build-push-artifacts.yml @@ -0,0 +1,71 @@ +# Adapted from https://github.com/stackhpc/azimuth/blob/master/.github/workflows/build-push-artifacts.yaml +name: Publish artifacts +# Run the tasks on every push +on: push +jobs: + build_push_images: + name: Build and push images + runs-on: ubuntu-latest + # strategy: + # matrix: + # include: + # - component: api + # - component: ui + steps: + - name: Check out the repository + uses: actions/checkout@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Calculate metadata for image + id: image-meta + uses: docker/metadata-action@v4 + with: + # images: ghcr.io/stackhpc/azimuth-${{ matrix.component }} + images: ghcr.io/stackhpc/azimuth-llm-ui-base + # Produce the branch name or tag and the SHA as tags + tags: | + type=ref,event=branch + type=ref,event=tag + type=sha,prefix= + + - name: Build and push image + uses: stackhpc/github-actions/docker-multiarch-build-push@master + with: + # cache-key: ${{ matrix.component }} + # context: ./${{ matrix.component }} + cache-key: ui-base + context: ./images/ui + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.image-meta.outputs.tags }} + labels: ${{ steps.image-meta.outputs.labels }} + + build_push_chart: + name: Build and push Helm chart + runs-on: ubuntu-latest + # Only build and push the chart if the images built successfully + needs: [build_push_images] + steps: + - name: Check out the repository + uses: actions/checkout@v3 + with: + # This is important for the semver action to work correctly + # when determining the number of commits since the last tag + fetch-depth: 0 + + - name: Get SemVer version for current commit + id: semver + uses: stackhpc/github-actions/semver@master + + - name: Publish Helm charts + uses: stackhpc/github-actions/helm-publish@master + with: + token: ${{ secrets.GITHUB_TOKEN }} + version: ${{ steps.semver.outputs.version }} + app-version: ${{ steps.semver.outputs.short-sha }} \ No newline at end of file diff --git a/.helmignore b/.helmignore index 4e5de83..c15592a 100644 --- a/.helmignore +++ b/.helmignore @@ -28,4 +28,5 @@ Dockerfile gradio-app.py kubeconfig.yml venv/ -__pycache__/ \ No newline at end of file +__pycache__/ +images/ \ No newline at end of file diff --git a/Dockerfile b/images/ui-base/Dockerfile similarity index 75% rename from Dockerfile rename to images/ui-base/Dockerfile index 9308774..3ba9ff9 100644 --- a/Dockerfile +++ b/images/ui-base/Dockerfile @@ -1,5 +1,5 @@ -FROM amd64/python:3.11-slim +FROM python:3.11-slim ENV GRADIO_SERVER_PORT=7680