|
1 | | -# .github/workflows/ci.yml |
2 | | -name: CI / Docker Build |
| 1 | +name: Build & Publish Docker Image |
3 | 2 |
|
4 | 3 | on: |
5 | 4 | push: |
6 | 5 | branches: [ main ] |
7 | 6 | pull_request: |
8 | 7 | branches: [ main ] |
9 | 8 |
|
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + packages: write |
| 12 | + |
10 | 13 | jobs: |
11 | | - build: |
| 14 | + build-and-push: |
12 | 15 | runs-on: ubuntu-latest |
13 | | - env: |
14 | | - MODE: local |
15 | | - FFMPEG_PATH: /usr/bin/ffmpeg |
16 | | - FFPROBE_PATH: /usr/bin/ffprobe |
17 | | - VMAF_PATH: /usr/bin/true # no-op in CI |
18 | 16 |
|
19 | 17 | steps: |
20 | | - - name: Checkout repository |
| 18 | + - name: Checkout code |
21 | 19 | uses: actions/checkout@v4 |
22 | 20 |
|
23 | | - - name: Set up Python 3.10 |
24 | | - uses: actions/setup-python@v4 |
25 | | - with: |
26 | | - python-version: '3.10' |
27 | | - |
28 | | - - name: Install system FFmpeg |
29 | | - run: | |
30 | | - sudo apt-get update |
31 | | - sudo apt-get install -y ffmpeg |
32 | | -
|
33 | | - - name: Install Python dependencies |
34 | | - run: | |
35 | | - python -m pip install --upgrade pip |
36 | | - pip install --no-cache-dir -r requirements.txt |
| 21 | + - name: Set up QEMU (for multi‑arch) |
| 22 | + uses: docker/setup-qemu-action@v2 |
37 | 23 |
|
38 | | - - name: Set PYTHONPATH for imports |
39 | | - run: echo "PYTHONPATH=${{ github.workspace }}" >> $GITHUB_ENV |
40 | | - |
41 | | - - name: Build multi-arch Docker image (no load) |
| 24 | + - name: Set up Docker Buildx |
42 | 25 | uses: docker/setup-buildx-action@v3 |
43 | 26 |
|
44 | | - - name: Build Docker image |
| 27 | + - name: Log in to GitHub Container Registry |
| 28 | + uses: docker/login-action@v2 |
| 29 | + with: |
| 30 | + registry: ghcr.io |
| 31 | + username: ${{ github.actor }} |
| 32 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 33 | + |
| 34 | + - name: Build and push multi-arch image |
45 | 35 | uses: docker/build-push-action@v4 |
46 | 36 | with: |
47 | 37 | context: . |
48 | 38 | file: Dockerfile |
49 | 39 | platforms: linux/amd64,linux/arm64 |
50 | | - push: false |
51 | | - load: false |
52 | | - tags: ffmpeg-api-service:latest |
| 40 | + push: true |
| 41 | + tags: | |
| 42 | + ghcr.io/${{ github.repository_owner }}/ffmpeg-api-service:latest |
| 43 | + ghcr.io/${{ github.repository_owner }}/ffmpeg-api-service:${{ github.sha }} |
0 commit comments