Skip to content

Deploy Docker Image to Hugging Face Spaces #10

Deploy Docker Image to Hugging Face Spaces

Deploy Docker Image to Hugging Face Spaces #10

Workflow file for this run

name: Deploy Docker Image to Hugging Face Spaces
on:
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install Python dependencies
run: pip install --upgrade huggingface_hub
- name: Create Dockerfile
run: |
echo 'FROM drfyup/rss2tg:latest' > Dockerfile
- name: Upload Dockerfile to Hugging Face Spaces
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
SPACE_ID: drfy/rss2tg # 替换为你的Space ID,例如 `username/my-space`
run: |
python -c "
from huggingface_hub import HfApi
api = HfApi()
api.upload_file(
path_or_fileobj='Dockerfile',
path_in_repo='Dockerfile',
repo_id='${{ env.SPACE_ID }}',
repo_type='space',
token='${{ secrets.HF_TOKEN }}'
)
"