Skip to content

Commit

Permalink
Add workflow for docker images
Browse files Browse the repository at this point in the history
  • Loading branch information
stwiname committed Oct 8, 2024
1 parent 5a72b34 commit 840ec98
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
File renamed without changes.
67 changes: 67 additions & 0 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Docker Publish
on:
release:
types:
- published
workflow_dispatch:
inputs:
isLatest:
description: 'Add latest tag'
default: 'true'
required: true

jobs:
publish-docker:
name: test
runs-on: ubuntu-latest

permissions:
id-token: write # Needed for auth with Deno Deploy
contents: read # Needed to clone the repository

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 DockerHub
uses: docker/login-action@v3
with:
username: subquerynetwork
password: ${{ secrets.SQ_DOCKERHUB_TOKEN }}

# Read the version from deno.json
- name: Extract version
id: extract_version
run: |
version=$(cat deno.json | jq -r '.version')
echo "AI_APP_VERSION=$version" >> $GITHUB_ENV
- name: Build and push
if: github.event_name == 'workflow_dispatch' && github.event.inputs.isLatest == 'false'
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: arm64,amd64
file: ./Dockerfile
tags: subquerynetwork/subql-ai-app
build-args: RELEASE_VERSION=${{ env.AI_APP_VERSION }}

- name: Build and push
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.isLatest == 'true')
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: arm64,amd64
file: ./Dockerfile
tags: subquerynetwork/subql-ai-app:v${{ env.AI_APP_VERSION }},subquerynetwork/subql-ai-app:latest
build-args: RELEASE_VERSION=${{ env.AI_APP_VERSION }}

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,10 @@ run a command like so:
## Tests

Running tests: `deno test`


### Installing

To install

`deno install -g -f --allow-env --allow-net --allow-read --allow-write --allow-ffi --allow-run --unstable-worker-options -n subql-ai ./src/index.ts`

0 comments on commit 840ec98

Please sign in to comment.