1+ name : Docker Image CI
2+
3+ on :
4+ push :
5+ tags :
6+ - ' v*' # Trigger on version tags like v1.0.0, v0.13.0, etc.
7+ workflow_dispatch : # Allow manual triggering for testing
8+
9+ env :
10+ REGISTRY : docker.io
11+ IMAGE_NAME : basicmachines/basic-memory
12+
13+ jobs :
14+ docker :
15+ runs-on : ubuntu-latest
16+ permissions :
17+ contents : read
18+ packages : write
19+
20+ steps :
21+ - name : Checkout repository
22+ uses : actions/checkout@v4
23+ with :
24+ fetch-depth : 0
25+
26+ - name : Set up Docker Buildx
27+ uses : docker/setup-buildx-action@v3
28+ with :
29+ platforms : linux/amd64,linux/arm64
30+
31+ - name : Log in to Docker Hub
32+ uses : docker/login-action@v3
33+ with :
34+ registry : ${{ env.REGISTRY }}
35+ username : ${{ secrets.DOCKER_USERNAME }}
36+ password : ${{ secrets.DOCKER_PASSWORD }}
37+
38+ - name : Extract metadata
39+ id : meta
40+ uses : docker/metadata-action@v5
41+ with :
42+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
43+ tags : |
44+ type=ref,event=branch
45+ type=ref,event=pr
46+ type=semver,pattern={{version}}
47+ type=semver,pattern={{major}}.{{minor}}
48+ type=raw,value=latest,enable={{is_default_branch}}
49+
50+ - name : Build and push Docker image
51+ uses : docker/build-push-action@v5
52+ with :
53+ context : .
54+ file : ./Dockerfile
55+ platforms : linux/amd64,linux/arm64
56+ push : true
57+ tags : ${{ steps.meta.outputs.tags }}
58+ labels : ${{ steps.meta.outputs.labels }}
59+ cache-from : type=gha
60+ cache-to : type=gha,mode=max
61+
62+ - name : Update Docker Hub description
63+ uses : peter-evans/dockerhub-description@v4
64+ with :
65+ username : ${{ secrets.DOCKER_USERNAME }}
66+ password : ${{ secrets.DOCKER_PASSWORD }}
67+ repository : ${{ env.IMAGE_NAME }}
68+ readme-filepath : ./docs/Docker.md
0 commit comments