Skip to content
This repository was archived by the owner on Oct 20, 2024. It is now read-only.

Commit 9349539

Browse files
committed
Github CI
1 parent f47c783 commit 9349539

File tree

2 files changed

+79
-10
lines changed

2 files changed

+79
-10
lines changed

.github/workflows/dockerimage.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: docker build
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- "README.md"
7+
branches:
8+
- master
9+
pull_request:
10+
branches:
11+
- master
12+
release:
13+
types:
14+
- created
15+
schedule:
16+
- cron: "0 0 1 * *"
17+
18+
jobs:
19+
build:
20+
if: "!contains(github.event.commits[0].message, '[skip ci]')"
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v2
25+
26+
- name: Prepare
27+
id: prepare
28+
run: |
29+
HEAD_TAG=$(git tag --points-at HEAD)
30+
PLATFORMS=linux/arm/v6,linux/arm/v7,linux/arm64
31+
VERSION=latest
32+
33+
if [[ $HEAD_TAG =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
34+
VERSION=${HEAD_TAG//v}
35+
fi
36+
37+
echo ::set-output name=version::${VERSION}
38+
echo ::set-output name=docker_image::${GITHUB_REPOSITORY//docker-}
39+
echo ::set-output name=platforms::${PLATFORMS}
40+
41+
- name: Build on pull request
42+
if: success() && github.event_name == 'pull_request'
43+
run: |
44+
docker build .
45+
46+
- name: Set up Docker Buildx
47+
if: success() && github.event_name != 'pull_request'
48+
uses: crazy-max/ghaction-docker-buildx@v3
49+
with:
50+
buildx-version: latest
51+
qemu-version: latest
52+
53+
- name: Docker Login
54+
if: success() && github.event_name != 'pull_request'
55+
env:
56+
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
57+
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
58+
run: |
59+
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
60+
61+
- name: Build & Push
62+
if: success() && github.event_name != 'pull_request'
63+
run: |
64+
docker buildx build \
65+
--platform ${{ steps.prepare.outputs.platforms }} \
66+
--tag ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }} \
67+
--file ./Dockerfile \
68+
--push .
69+

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Raspberry Pi variable speed cooling fan controller
2-
2+
![Docker Build](https://github.com/pilotak/docker-rpi-fan/workflows/docker%20build/badge.svg) ![Docker Pulls](https://img.shields.io/docker/pulls/pilotak/rpi-fan) ![Docker Size](https://img.shields.io/docker/image-size/pilotak/rpi-fan?color=orange)
33
Docker container that keeps the CPU temperature at desired level with PWM enabled fan based on [http://www.sensorsiot.org/variable-speed-cooling-fan-for-raspberry-pi-using-pwm-video138/](http://www.sensorsiot.org/variable-speed-cooling-fan-for-raspberry-pi-using-pwm-video138/)
44

55
## Docker-compose
@@ -25,15 +25,15 @@ services:
2525
### Environmental variables
2626
Bellow are all available variables
2727
28-
| Variable | Description | Default value |
28+
| Variable | Description | Default value | Units |
2929
| --- | --- | :---:|
30-
| `DESIRED_TEMP` | Temperature it tries to keep it at *(°C)* | 40 |
31-
| `FAN_PIN` | PWM pin where is mosfet driver or load-switch connected to | 13 |
32-
| `FAN_PWM_MIN` | Minimal duty cycle to turn the fan on *(%)* | 20 |
33-
| `FAN_PWM_MAX` | Maximal duty cycle of fan *(%)* | 100 |
34-
| `FAN_PWM_FREQ` | Broker address *(Hz)* | 17 |
35-
| `P_TEMP` | Proportional constant | 18.0 |
36-
| `I_TEMP` | Integral constant | 0.3 |
37-
| `READ_INTERVAL` | How often read the temperature *(seconds)* | 2 |
30+
| `DESIRED_TEMP` | Temperature it tries to keep it at | 40 | °C |
31+
| `FAN_PIN` | PWM pin where is mosfet driver or load-switch connected to | 13 | |
32+
| `FAN_PWM_MIN` | Minimal duty cycle to turn the fan on | 20 | % |
33+
| `FAN_PWM_MAX` | Maximal duty cycle of fan | 100 | % |
34+
| `FAN_PWM_FREQ` | Broker address | 17 | Hz |
35+
| `P_TEMP` | Proportional constant | 18.0 | |
36+
| `I_TEMP` | Integral constant | 0.3 | |
37+
| `READ_INTERVAL` | How often read the temperature | 2 | seconds |
3838

3939

0 commit comments

Comments
 (0)