38 lines
No EOL
1,015 B
YAML
38 lines
No EOL
1,015 B
YAML
name: Build & Push Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches: [main, master]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to Forgejo Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: git.khoavo.myds.me
|
|
username: ${{ secrets.FORGEJO_USERNAME }}
|
|
password: ${{ secrets.FORGEJO_TOKEN }}
|
|
|
|
- name: Build and push
|
|
env:
|
|
IMAGE: git.khoavo.myds.me/vndangkhoa/kv-tube
|
|
run: |
|
|
SHA_SHORT=$(git rev-parse --short HEAD)
|
|
|
|
# Build with platform for Synology NAS (linux/amd64)
|
|
docker build --platform linux/amd64 -t ${IMAGE}:${SHA_SHORT} -t ${IMAGE}:latest .
|
|
|
|
# Push both tags
|
|
docker push ${IMAGE}:${SHA_SHORT}
|
|
docker push ${IMAGE}:latest |