Skip to content

Commit 6398df3

Browse files
Create ci.yml
1 parent e359866 commit 6398df3

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

.github/workflows/ci.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: CI / Docker Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
test-and-build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
# 1. Checkout your repository
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
# 2. Set up Python 3.10
20+
- name: Set up Python
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: '3.10'
24+
25+
# 3. Install dependencies & run tests
26+
- name: Install Python dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install --no-cache-dir -r requirements.txt
30+
- name: Run pytest
31+
run: |
32+
pytest --maxfail=1 --disable-warnings -q
33+
34+
# 4. Set up Docker Buildx (for building images)
35+
- name: Set up Docker Buildx
36+
uses: docker/setup-buildx-action@v3
37+
38+
# 5. Build Docker image
39+
- name: Build Docker image
40+
uses: docker/build-push-action@v4
41+
with:
42+
context: .
43+
file: Dockerfile
44+
platforms: linux/amd64,linux/arm64
45+
push: false
46+
tags: ffmpeg-api-service:latest
47+
48+
# 6. (Optional) Log in & push to GitHub Container Registry
49+
# To enable, add CR_PAT secret in your repo settings
50+
- name: Log in to GHCR
51+
if: secrets.CR_PAT != ''
52+
uses: docker/login-action@v2
53+
with:
54+
registry: ghcr.io
55+
username: ${{ github.actor }}
56+
password: ${{ secrets.CR_PAT }}
57+
58+
- name: Push Docker image to GHCR
59+
if: secrets.CR_PAT != ''
60+
uses: docker/build-push-action@v4
61+
with:
62+
context: .
63+
file: Dockerfile
64+
platforms: linux/amd64,linux/arm64
65+
push: true
66+
tags: |
67+
ghcr.io/${{ github.repository_owner }}/ffmpeg-api-service:latest

0 commit comments

Comments
 (0)