Skip to content

Commit 772830b

Browse files
docker image, github workflow
1 parent dbdde8e commit 772830b

File tree

5 files changed

+95
-1
lines changed

5 files changed

+95
-1
lines changed

.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.git/
2+
.github/
3+
venv/
4+
.env
5+
example-*
6+
test.conf

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"

.github/workflows/build-image.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Build Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths-ignore:
8+
- README.md
9+
release:
10+
types: [published]
11+
12+
jobs:
13+
docker:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v3.0.2
18+
19+
- name: Set up QEMU
20+
uses: docker/setup-qemu-action@v2
21+
22+
- name: Docker meta
23+
id: meta
24+
uses: docker/metadata-action@v4.0.1
25+
with:
26+
images: mkoetter/netbox-kea-subnets
27+
tags: |
28+
type=edge
29+
type=semver,pattern={{version}}
30+
type=semver,pattern={{major}}.{{minor}}
31+
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
32+
33+
- name: Set up Docker Buildx
34+
uses: docker/setup-buildx-action@v2
35+
36+
- name: Login to DockerHub
37+
uses: docker/login-action@v2
38+
with:
39+
username: ${{ secrets.DOCKERHUB_USERNAME }}
40+
password: ${{ secrets.DOCKERHUB_TOKEN }}
41+
42+
- name: Build and push
43+
id: docker_build
44+
uses: docker/build-push-action@v3.1.1
45+
with:
46+
context: .
47+
push: true
48+
platforms: linux/amd64, linux/arm/v6, linux/arm/v7, linux/arm64/v8
49+
tags: ${{ steps.meta.outputs.tags }}
50+
labels: ${{ steps.meta.outputs.labels }}
51+
52+
- name: Image digest
53+
run: echo ${{ steps.docker_build.outputs.digest }}
54+
55+
- name: Docker Hub Description
56+
uses: peter-evans/dockerhub-description@v3
57+
with:
58+
username: ${{ secrets.DOCKERHUB_USERNAME }}
59+
password: ${{ secrets.DOCKERHUB_TOKEN }}
60+
repository: mkoetter/netbox-kea-subnets
61+
short-description: ${{ github.event.repository.description }}

Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM python:3-alpine
2+
3+
WORKDIR /usr/src/app
4+
5+
COPY requirements.txt ./
6+
RUN pip install --no-cache-dir -r requirements.txt
7+
8+
COPY . .
9+
10+
ENTRYPOINT [ "python", "./kea-subnets.py" ]

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
# Configure Kea DHCP Subnets using Netbox
22

3+
[![Build Docker Image](https://github.com/michaelkoetter/netbox-kea-subnets/actions/workflows/build-image.yml/badge.svg)](https://github.com/michaelkoetter/netbox-kea-subnets/actions/workflows/build-image.yml)
4+
[![image-version](https://img.shields.io/static/v1?logo=docker&label=Docker+Hub&message=mkoetter/netbox-kea-subnets&color=informational)](https://hub.docker.com/r/mkoetter/netbox-kea-subnets)
5+
36
This script fetches data from Netbox to create Kea subnet configuration from Prefixes, IP Ranges and IP Addresses.
47

58
A Jinja2 template is used to render each subnet. It can be customized to add additional data, e.g. from Netbox custom fields (see example in `templates`).
69

7-
## Installation
10+
## Docker Images
11+
12+
Docker Images are automatically built for new releases.
13+
14+
```bash
15+
docker run --rm mkoetter/netbox-kea-subnets:latest --help
16+
```
17+
18+
## Development
819

920
```bash
1021
python3 -m venv venv/

0 commit comments

Comments
 (0)