Skip to content

Commit

Permalink
chore: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmarksilly committed Mar 31, 2023
0 parents commit 852c75c
Show file tree
Hide file tree
Showing 21 changed files with 1,414 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
clips/
139 changes: 139 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
kind: pipeline
type: docker
name: default

steps:
- name: "Build"
image: plugins/docker
settings:
repo: git.brilliantmonkey.net/frigate/clips
registry: git.brilliantmonkey.net
username: docker
password:
from_secret: GITEA_DOCKER_TOKEN
custom_dns:
- 10.5.10.8
tags:
- ${DRONE_BUILD_NUMBER}-${DRONE_COMMIT:0:4}
when:
event:
- push
- name: "[TAG] Publish to Gitea"
image: plugins/docker
settings:
repo: git.brilliantmonkey.net/frigate/clips
registry: git.brilliantmonkey.net
username: docker
password:
from_secret: GITEA_DOCKER_TOKEN
custom_dns:
- 10.5.10.8
tags:
- ${DRONE_TAG}
- latest
when:
event:
- tag
- name: "[TAG] Publish to Github"
image: plugins/docker
settings:
repo: ghcr.io/brilliant-monkey/frigate:clips
username: docker
password:
from_secret: GITHUB_CONTAINER_REGISTRY_TOKEN
tags:
- ${DRONE_TAG}
- latest
environment:
BUILD_ENV: production
registry: git.brilliantmonkey.net
custom_dns:
- 10.5.10.8
when:
event:
- tag
- name: "[Master] Deploy"
image: quay.io/honestbee/drone-kubernetes
settings:
namespace: default
deployment: frigate-clips
container: app
repo: git.brilliantmonkey.net/frigate/clips
tag: ${DRONE_BUILD_NUMBER}-${DRONE_COMMIT:0:4}
kubernetes_server:
from_secret: KUBE_SERVER
kubernetes_token:
from_secret: DRONE_TOKEN
kubernetes_cert:
from_secret: KUBE_CA
when:
event:
- push
branch:
- master
- name: "[Tag] Deploy"
image: quay.io/honestbee/drone-kubernetes
settings:
namespace: default
deployment: frigate-clips
container: app
repo: git.brilliantmonkey.net/frigate/clips
tag: ${DRONE_TAG}
kubernetes_server:
from_secret: KUBE_SERVER_PROD
kubernetes_token:
from_secret: DRONE_TOKEN_PROD
kubernetes_cert:
from_secret: KUBE_CA_PROD
when:
event:
- tag
- name: '[Push] Slack'
image: plugins/slack
settings:
webhook:
from_secret: SLACK_WEBHOOK_URL
channel: ci
link_names: true
template: >
{{#success build.status}}
*Build Completed Successfully*
`{{repo.name}}` — <{{build.link}}|Build #{{build.number}} on {{build.branch}}>
{{else}}
*Build Failed*
`{{repo.name}}` — <{{build.link}}|Build #{{build.number}} on {{build.branch}}>
{{/success}}
when:
event:
- push
branch:
- master
status:
- success
- failure

- name: '[TAG] Slack'
image: plugins/slack
settings:
webhook:
from_secret: SLACK_WEBHOOK_URL
channel: ci
link_names: true
template: >
{{#success build.status}}
*Deployment to Production Completed Successfully*
`{{repo.name}}` version {{tag}} — <{{build.link}}|Build #{{build.number}}>
{{else}}
*Deployment to Production Failed*
`{{repo.name}}` version {{tag}}— <{{build.link}}|Build #{{build.number}}>
{{/success}}
when:
event:
- tag
status:
- success
- failure
27 changes: 27 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: main

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/github-script@v6
id: tag
with:
result-encoding: string
script: return context.sha.substring(0,7)
- name: login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: create image from repository
run: docker buildx build --platform linux/amd64 --cache-to type=gha --cache-from type=gha -t ghcr.io/${{ github.repository }}:${{ steps.tag.outputs.result }} .
- name: push image to GitHub Container Registry
run: docker push ghcr.io/${{ github.repository }}:${{ steps.tag.outputs.result }}
42 changes: 42 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: pull-request

on:
pull_request:
branches:
- "*"

env:
SHA: ${{ github.sha }}
REPO: ${{ github.repository }}
PR: ${{ github.event.pull_request.number }}

jobs:
setup:
runs-on: ubuntu-latest
outputs:
image_name: ${{ steps.tag.outputs.image_name }}
steps:
- name: Get Docker image name
id: tag
run: |
export TAG=$(echo $SHA | cut -c 1-6)
export IMAGE_NAME=$(echo ghcr.io/$REPO:$TAG-$PR)
echo $IMAGE_NAME
echo "image_name=$IMAGE_NAME" >> $GITHUB_OUTPUT
build:
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: create image from repository
run: docker buildx build --platform linux/amd64 --cache-to type=gha --cache-from type=gha -t ${{ needs.setup.outputs.image_name }} .
- name: push image to GitHub Container Registry
run: docker push ${{ needs.setup.outputs.image_name }}
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: release

on:
push:
tags:
- "*"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
id: tag
with:
result-encoding: string
script: return context.sha.substring(0,7)
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull Latest
run: docker pull ghcr.io/${{ github.repository }}:${{ steps.tag.outputs.result }}
- name: Tag Latest
run: docker tag ghcr.io/${{ github.repository }}:${{ steps.tag.outputs.result }} ghcr.io/${{ github.repository }}:latest
- name: Tag Version
run: docker tag ghcr.io/${{ github.repository }}:${{ steps.tag.outputs.result }} ghcr.io/${{ github.repository }}:${{ github.ref_name }}
- name: push image to GitHub Container Registry
run: docker push --all-tags ghcr.io/${{ github.repository }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**/*.mp4
.DS_store

**/*secret*
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

FROM golang:1.18 AS build

WORKDIR /app

COPY . .

RUN go mod download

RUN go build -o runtime cmd/main.go

FROM linuxserver/ffmpeg

WORKDIR /app

COPY --from=build /app/runtime .

ENTRYPOINT [ "./runtime" ]
Loading

0 comments on commit 852c75c

Please sign in to comment.