build: docker workflow

This commit is contained in:
Adrian Shum 2022-09-08 22:58:06 +08:00
parent 2451fa1b5a
commit 89e3e207c9
3 changed files with 103 additions and 3 deletions

7
.github/dependabot.yml vendored Normal file
View file

@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: gomod
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10

93
.github/workflows/docker.yml vendored Normal file
View file

@ -0,0 +1,93 @@
name: docker
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
on:
push:
branches: [ master ]
tags: [ 'v*.*.*' ]
jobs:
build:
name: Docker
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Setup qemu for Docker buildx
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v2
with:
image: tonistiigi/binfmt:latest
platforms: arm64
# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
with:
version: latest
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
if: github.repository == 'cshum/imagorvideo'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: |
name=${{ format('ghcr.io/{0}', github.repository) }},enable=true
name=shumc/imagorvideo,enable=${{ github.repository == 'cshum/imagorvideo' }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image tag
if: startsWith(github.ref, 'refs/tags/v')
id: build-and-push-tag
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Build and push Docker image branch
if: startsWith(github.ref, 'refs/heads')
id: build-and-push-branch
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View file

@ -1,12 +1,12 @@
# imagorvideo # imagorvideo
imagorvideo is a new initiative that brings video thumbnail capability through ffmpeg, built on the foundations of [imagor](https://github.com/cshum/imagor). imagor is a fast, Docker-ready image processing server written in Go with libvips. imagorvideo is a new initiative that brings video thumbnail capability through ffmpeg, built on the foundations of [imagor](https://github.com/cshum/imagor) - a fast, Docker-ready image processing server written in Go with libvips.
Imagorvideo uses ffmpeg C bindings that extracts image thumbnail from video by attempting to select the best frame, then forwards to libvips to perform all existing image operations supported by imagor. Imagorvideo uses ffmpeg C bindings that extracts image thumbnail from video by attempting to select the best frame, then forwards to libvips to perform all existing image operations supported by imagor.
imagorvideo uses reader stream for mkv and webm video types. For other video types that requires seeking from a non seek-able source such as HTTP or S3, it simulates seek using memory buffer or temp file, by having the whole file to be fully loaded to perform seek. imagorvideo uses reader stream for mkv and webm video types. For other video types that requires seeking from a non seek-able source such as HTTP or S3, it simulates seek using memory buffer or temp file, by having the whole file to be fully loaded to perform seek.
**This project is a work in progress**. It also aims to be a reference project demonstrating imagor extensibility. Feel free to create a pull request or report an issue if you found bugs, suggestions or enhancements. **This project is a work in progress**. It also aims to be a reference project demonstrating imagor extensibility.
### Quick Start ### Quick Start
@ -18,7 +18,7 @@ Check out [imagor](https://github.com/cshum/imagor#image-endpoint) for all exist
### Configuration ### Configuration
Config options specific to imagorvideo. Check out [imagor](https://github.com/cshum/imagor#configuration) for all existing options supported. Config options specific to imagorvideo. Please refer to [imagor](https://github.com/cshum/imagor#configuration) for all existing options supported.
``` ```
-ffmpeg-fallback-image string -ffmpeg-fallback-image string