feat: deploy dockerfile & ci

This commit is contained in:
Steven Kreitzer 2023-07-19 07:55:20 -05:00
parent 98d68c15dd
commit e834e0ead5
5 changed files with 122 additions and 0 deletions

2
.github/CODEOWNERS vendored Normal file
View file

@ -0,0 +1,2 @@
# https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners
* @buroa

5
.github/renovate.json5 vendored Normal file
View file

@ -0,0 +1,5 @@
{
"extends": [
"config:base"
]
}

45
.github/workflows/ci.yaml vendored Normal file
View file

@ -0,0 +1,45 @@
---
name: ci
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

51
.github/workflows/release.yaml vendored Normal file
View file

@ -0,0 +1,51 @@
---
name: release
on:
push:
tags:
- v*
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}
flavor: |
latest=true
prefix=v
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push
if: github.event_name != 'pull_request'
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

19
Dockerfile Normal file
View file

@ -0,0 +1,19 @@
FROM debian:bookworm-slim as base
FROM base as build
RUN apt update && apt install build-essential -y
WORKDIR /app
COPY . .
RUN make install
FROM base as app
COPY --from=build /usr/sbin/mbpfan /usr/sbin/mbpfan
COPY --from=build /etc/mbpfan.conf /etc/mbpfan.conf
CMD ["/usr/sbin/mbpfan", "-f"]