Skip to content

Commit 39a6e4b

Browse files
committed
Add GitHub Actions workflow for releasing Docker image
1 parent e958839 commit 39a6e4b

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/release.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Release Docker Image
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build-and-push:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Docker Buildx
16+
uses: docker/setup-buildx-action@v3
17+
18+
- name: Log in to Docker Hub
19+
uses: docker/login-action@v3
20+
with:
21+
username: ${{ secrets.DOCKER_USERNAME }}
22+
password: ${{ secrets.DOCKER_PASSWORD }}
23+
24+
- name: Extract release version
25+
id: version
26+
run: |
27+
echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
28+
29+
- name: Build and push Docker image
30+
uses: docker/build-push-action@v5
31+
with:
32+
context: .
33+
file: ./Dockerfile
34+
push: true
35+
tags: |
36+
${{ secrets.DOCKER_USERNAME }}/memoryalpha-rag-api:latest
37+
${{ secrets.DOCKER_USERNAME }}/memoryalpha-rag-api:${{ steps.version.outputs.version }}
38+
platforms: linux/amd64,linux/arm64
39+
cache-from: type=gha
40+
cache-to: type=gha,mode=max
41+
42+
- name: Update Docker Hub description
43+
uses: peter-evans/dockerhub-description@v3
44+
with:
45+
username: ${{ secrets.DOCKER_USERNAME }}
46+
password: ${{ secrets.DOCKER_PASSWORD }}
47+
repository: ${{ secrets.DOCKER_USERNAME }}/memoryalpha-rag-api
48+
short-description: "REST API for RAG over Star Trek MemoryAlpha database using Ollama"
49+
readme-filepath: ./README.md

0 commit comments

Comments
 (0)