Start running GitHub actions over repo
Diff
Dockerfile | 14 ++++++++++++++
blueiris/lib.go | 1 +
.github/workflows/ci.yml | 22 ++++++++++++++++++++++
.github/workflows/docker.yml | 45 +++++++++++++++++++++++++++++++++++++++++++++
cmd/hkbi/main.go | 3 +--
5 files changed, 83 insertions(+), 2 deletions(-)
@@ -1,0 +1,14 @@
FROM golang:1.19.2-bullseye AS build
WORKDIR /build
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
RUN go build -o hkbi cmd/hkbi/main.go
FROM debian:bullseye
LABEL org.opencontainers.image.source="https://github.com/w4/hkbi"
WORKDIR /app
COPY --from=build /build/hkbi /app/hkbi
CMD ["/app/hkbi", "/data/config.toml"]
@@ -132,6 +132,7 @@
return response.Data, nil
}
func (b *Blueiris) triggerCamera(camera string) error {
b.mutex.RLock()
defer b.mutex.RUnlock()
@@ -1,0 +1,22 @@
on: ["push", "pull_request"]
name: "CI"
jobs:
ci:
name: "Run CI"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '^1.19.0'
check-latest: true
cache: true
- run: "go version"
- run: "go test ./..."
- run: "go vet ./..."
- uses: dominikh/staticcheck-action@v1.2.0
with:
version: "2022.1"
install-go: false
@@ -1,0 +1,45 @@
name: Build Docker image
on:
push:
branches: [ master ]
tags: [ 'v*.*.*' ]
pull_request:
branches: [ master ]
env:
REGISTRY: ghcr.io
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Docker buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/w4/hkbi
- name: Build and push
id: build-and-push
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
file: ./Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
@@ -38,7 +38,6 @@
type GlobalState struct {
ssrcVideo int32
ssrcAudio int32
blueiris *blueiris.Blueiris
}
func main() {
@@ -289,7 +288,7 @@
})
c := make(chan os.Signal)
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
signal.Notify(c, syscall.SIGTERM)