Skip to content

Commit

Permalink
chore: add docker image workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
listlessbird committed Nov 6, 2024
1 parent d3aced9 commit 4d49549
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 35 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
on:
push:
branches: ["release"]
pull_request:
branches: ["release"]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-publish:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- name: checkout
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'release') }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push renderer
id: push-renderer
uses: docker/build-push-action@v2
with:
context: .
file: ./renderer/dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Build and push web-app
id: push-web
uses: docker/build-push-action@v2
with:
context: .
file: ./web/dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Generate artifact attestation for renderer
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}-renderer
subject-digest: ${{ steps.push-renderer.outputs.digest }}
push-to-registry: true

- name: Generate artifact attestation for web-app
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}-web
subject-digest: ${{ steps.push-web.outputs.digest }}
push-to-registry: true
39 changes: 39 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: sparkles

services:
web:
image: web-ui
env_file:
- .env
build:
context: ./web
dockerfile: dockerfile
ports:
- "3000:3000"
environment:
- RENDERER_URL=http://renderer:3001
- NEXT_PUBLIC_BASE_URL=http://web:3000
- GROQ_API_KEY=${GROQ_API_KEY}
- GEMINI_API_KEY=${GEMINI_API_KEY}
- GOOGLE_API_KEY=${GOOGLE_API_KEY}
- CF_API_KEY=${CF_API_KEY}
- R2_ACCESS_KEY=${R2_ACCESS_KEY}
- R2_SECRET_KEY=${R2_SECRET_KEY}
- CF_ACCOUNT_ID=${CF_ACCOUNT_ID}
- BUCKET_NAME=${BUCKET_NAME}
- ASSEMBLY_API_KEY=${ASSEMBLY_API_KEY}
- REPLICATE_API_KEY=${REPLICATE_API_KEY}
- D1_ID=${D1_ID}
- D1_KEY=${D1_KEY}
- CF_ID=${CF_ID}

renderer:
image: ai-short-gen-renderer
build:
context: ./renderer
ports:
- "3001:3001"

networks:
default:
name: app-network
37 changes: 2 additions & 35 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ name: sparkles

services:
web:
image: web-ui
image: ghcr.io/listlessbird/sparkles-web:latest
env_file:
- .env
build:
context: ./web
dockerfile: dockerfile
ports:
- "3000:3000"
environment:
Expand All @@ -28,40 +25,10 @@ services:
- CF_ID=${CF_ID}

renderer:
image: ai-short-gen-renderer
build:
context: ./renderer
image: ghcr.io/listlessbird/sparkles-renderer:latest
ports:
- "3001:3001"

# secrets:
# GROQ_API_KEY:
# file: ./secrets/GROQ_API_KEY
# GEMINI_API_KEY:
# file: ./secrets/GEMINI_API_KEY
# GOOGLE_API_KEY:
# file: ./secrets/GOOGLE_API_KEY
# CF_API_KEY:
# file: ./secrets/CF_API_KEY
# R2_ACCESS_KEY:
# file: ./secrets/R2_ACCESS_KEY
# R2_SECRET_KEY:
# file: ./secrets/R2_SECRET_KEY
# CF_ACCOUNT_ID:
# file: ./secrets/CF_ACCOUNT_ID
# BUCKET_NAME:
# file: ./secrets/BUCKET_NAME
# ASSEMBLY_API_KEY:
# file: ./secrets/ASSEMBLY_API_KEY
# REPLICATE_API_KEY:
# file: ./secrets/REPLICATE_API_KEY
# D1_ID:
# file: ./secrets/D1_ID
# D1_KEY:
# file: ./secrets/D1_KEY
# CF_ID:
# file: ./secrets/CF_ID

networks:
default:
name: app-network

0 comments on commit 4d49549

Please sign in to comment.