MQL5-Google-Onedrive/.github/workflows/container-ci-cd.yml
google-labs-jules[bot] 6a08a1179d Bolt: register container registry and start building container
- Updated NotebookLM URL in docs/NOTEBOOK_LM_CONTEXT.txt, README.md, and AGENTS.md.
- Enhanced scripts/set_github_secrets.sh to support Docker Hub credentials.
- Integrated Docker Hub deployment into .github/workflows/cd.yml and .github/workflows/container-ci-cd.yml.
- Fixed typos and improved robustness in CD workflows.
2026-02-12 14:11:19 +00:00

104 lines
2.8 KiB
YAML

name: Container CI/CD Deployment
on:
push:
branches: [ main ]
paths:
- 'Dockerfile.mt5'
- 'scripts/**'
- '.github/workflows/container-ci-cd.yml'
workflow_dispatch:
inputs:
target:
description: 'Deployment Target'
required: true
default: 'ghcr'
type: choice
options:
- ghcr
- render
- railway
- flyio
- gcp
- all
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
DOCKER_HUB_IMAGE: mouyleng/mql5-trading-automation-full
jobs:
build-and-push:
name: Build and Push MT5 Container
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to Docker Hub
if: secrets.DOCKER_USERNAME != '' && secrets.DOCKER_PASSWORD != ''
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
${{ secrets.DOCKER_USERNAME != '' && secrets.DOCKER_PASSWORD != '' && env.DOCKER_HUB_IMAGE || '' }}
tags: |
type=ref,event=branch
type=sha,prefix=mt5-
type=raw,value=mt5-latest,enable=${{ github.ref == 'refs/heads/main' }}
- name: Build and push MT5 image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile.mt5
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
deploy-cloud:
name: Deploy to Cloud
needs: build-and-push
runs-on: ubuntu-latest
if: github.event.inputs.target != 'ghcr' && github.event.inputs.target != ''
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Run Deployment Script
run: |
pip install -r requirements.txt || true
python scripts/deploy_cloud.py ${{ github.event.inputs.target }}
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
RENDER_API_KEY: ${{ secrets.RENDER_API_KEY }}
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}