add build workflows and docker image

This commit is contained in:
2025-10-21 10:59:53 +02:00
parent 39009ccb35
commit 4ed1f26694
7 changed files with 214 additions and 0 deletions

10
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "monthly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"

34
.github/workflows/ci.yaml vendored Normal file
View File

@@ -0,0 +1,34 @@
name: build
on: [push]
jobs:
build:
strategy:
matrix:
version: [1.24]
os: [ubuntu-latest]
name: Build
runs-on: ${{ matrix.os }}
steps:
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.version }}
id: go
- name: checkout
uses: actions/checkout@v5
- name: build
run: go build
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v6
with:
go-version: 1.24
- uses: actions/checkout@v5
- name: golangci-lint
uses: golangci/golangci-lint-action@v8

34
.github/workflows/pushimage.yaml vendored Normal file
View File

@@ -0,0 +1,34 @@
name: build-push-image
on:
push:
tags:
- 'v*'
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Log in to the Container registry
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef
with:
registry: https://ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
with:
push: true
tags: ghcr.io/tlinden/io-exporter:${{ github.ref_name}}
- name: Build and push latest Docker image
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
with:
push: true
tags: ghcr.io/tlinden/io-exporter:latest

86
.github/workflows/release.yaml vendored Normal file
View File

@@ -0,0 +1,86 @@
name: build-release
on:
push:
tags:
- "v*.*.*"
jobs:
release:
name: Build Release Assets
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: 1.24.5
- name: Build the executables
run:
- go build
- mv io-exporter io-exporter-amd64-linux-${{ github.ref_name}}
- name: Upload the binaries
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
file: io-exporter-amd64-linux-${{ github.ref_name}}
file_glob: false
- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
mode: "PR"
configurationJson: |
{
"template": "#{{CHANGELOG}}\n\n**Full Changelog**: #{{RELEASE_DIFF}}",
"pr_template": "- #{{TITLE}} (##{{NUMBER}}) by #{{AUTHOR}}\n#{{BODY}}",
"empty_template": "- no changes",
"categories": [
{
"title": "## New Features",
"labels": ["add", "feature"]
},
{
"title": "## Bug Fixes",
"labels": ["fix", "bug", "revert"]
},
{
"title": "## Documentation Enhancements",
"labels": ["doc"]
},
{
"title": "## Refactoring Efforts",
"labels": ["refactor"]
},
{
"title": "## Miscellaneus Changes",
"labels": []
}
],
"ignore_labels": [
"duplicate", "good first issue", "help wanted", "invalid", "question", "wontfix"
],
"label_extractor": [
{
"pattern": "(.) (.+)",
"target": "$1"
},
{
"pattern": "(.) (.+)",
"target": "$1",
"on_property": "title"
}
]
}
- name: Create Release
uses: softprops/action-gh-release@v2
with:
body: ${{steps.github_release.outputs.changelog}}

25
Dockerfile Normal file
View File

@@ -0,0 +1,25 @@
FROM golang:1.24-alpine as builder
RUN apk update
RUN apk upgrade
RUN apk add --no-cache git make
RUN git --version
WORKDIR /work
COPY go.mod .
COPY . .
RUN go mod download
RUN go build
FROM alpine:latest
LABEL maintainer="Thomas von Dein <git@daemon.de>"
WORKDIR /app
COPY --from=builder /work/io-exporter /app/io-exporter
USER 1001:1001
ENTRYPOINT ["/app/io-exporter"]
CMD ["-h"]

View File

@@ -54,6 +54,23 @@ Or, if you have GNU Make installed, just execute:
go build
```
## Docker
To build:
```default
docker compose build
```
To run locally:
```default
mkdir t
chmod 1777 t
docker compose run -v ./t:/pvc ioexporter /pvc/blah
```
# Report bugs
[Please open an issue](https://github.com/TLINDEN/io-exporter/issues). Thanks!

8
docker-compose.yaml Normal file
View File

@@ -0,0 +1,8 @@
services:
ioexporter:
container_name: io-exporter
volumes:
- ${PWD}:/pvc
working_dir: /pvc
build: .
image: io-exporter:latest