Skip to content

"Vibe-Trading: Your Personal Trading Agent"

Add Docker build and push workflow

birdxse4e811e8bc67
diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml
new file mode 100644
index 000000000..8b1910ccb
--- /dev/null
+++ b/.github/workflows/docker-build.yml
@@ -0,0 +1,106 @@
+name: Build and Push Docker Image
+
+on:
+ workflow_dispatch:
+ inputs:
+ image_tag:
+ description: 'Image tag (e.g., v1.0.0, latest)'
+ required: true
+ default: 'latest'
+
+env:
+ GHCR_REGISTRY: ghcr.io
+ DOCKERHUB_REGISTRY: docker.io
+ GHCR_IMAGE_NAME: ${{ github.repository }}
+ DOCKERHUB_IMAGE_NAME: ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}
+
+jobs:
+ build-and-push:
+ runs-on: ubuntu-24.04
+ permissions:
+ contents: read
+ packages: write
+ id-token: write
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+ with:
+ driver-opts: |
+ image=moby/buildkit:master
+ network=host
+
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v3
+
+ - name: Log in to GHCR
+ uses: docker/login-action@v3
+ with:
+ registry: ${{ env.GHCR_REGISTRY }}
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Log in to Docker Hub
+ uses: docker/login-action@v3
+ with:
+ registry: ${{ env.DOCKERHUB_REGISTRY }}
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+
+ - name: Extract metadata for GHCR
+ id: meta-ghcr
+ uses: docker/metadata-action@v5
+ with:
+ images: ${{ env.GHCR_REGISTRY }}/${{ env.GHCR_IMAGE_NAME }}
+ tags: |
+ type=raw,value=${{ inputs.image_tag }}
+ type=raw,value=latest,enable=${{ inputs.image_tag != 'latest' }}
+
+ - name: Extract metadata for Docker Hub
+ id: meta-dockerhub
+ uses: docker/metadata-action@v5
+ with:
+ images: ${{ env.DOCKERHUB_REGISTRY }}/${{ env.DOCKERHUB_IMAGE_NAME }}
+ tags: |
+ type=raw,value=${{ inputs.image_tag }}
+ type=raw,value=latest,enable=${{ inputs.image_tag != 'latest' }}
+
+ - name: Build and push
+ uses: docker/build-push-action@v5
+ with:
+ context: .
+ file: Dockerfile
+ platforms: linux/amd64,linux/arm64
+ push: true
+ tags: |
+ ${{ steps.meta-ghcr.outputs.tags }}
+ ${{ steps.meta-dockerhub.outputs.tags }}
+ labels: ${{ steps.meta-ghcr.outputs.labels }}
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
+
+ - name: Update Docker Hub description
+ uses: peter-evans/dockerhub-description@v4
+ with:
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+ repository: ${{ env.DOCKERHUB_IMAGE_NAME }}
+ readme-filepath: ./README.md
+ short-description: "AI trading agent with backtesting. Includes Telegram & Feishu channels."
+
+ - name: Summary
+ run: |
+ echo "### Docker Images Built and Pushed" >> $GITHUB_STEP_SUMMARY
+ echo "" >> $GITHUB_STEP_SUMMARY
+ echo "**GHCR:** \`${{ env.GHCR_REGISTRY }}/${{ env.GHCR_IMAGE_NAME }}:${{ inputs.image_tag }}\`" >> $GITHUB_STEP_SUMMARY
+ echo "**Docker Hub:** \`${{ env.DOCKERHUB_REGISTRY }}/${{ env.DOCKERHUB_IMAGE_NAME }}:${{ inputs.image_tag }}\`" >> $GITHUB_STEP_SUMMARY
+ echo "" >> $GITHUB_STEP_SUMMARY
+ echo "**Platforms:** linux/amd64, linux/arm64" >> $GITHUB_STEP_SUMMARY
+ echo "**Channels:** feishu, telegram" >> $GITHUB_STEP_SUMMARY
+ echo "" >> $GITHUB_STEP_SUMMARY
+ echo '```bash' >> $GITHUB_STEP_SUMMARY
+ echo "docker pull ${{ env.GHCR_REGISTRY }}/${{ env.GHCR_IMAGE_NAME }}:${{ inputs.image_tag }}" >> $GITHUB_STEP_SUMMARY
+ echo '```' >> $GITHUB_STEP_SUMMARY