This commit is contained in:
commit
74c385df68
164
.drone.yml
Normal file
164
.drone.yml
Normal file
@ -0,0 +1,164 @@
|
||||
---
|
||||
kind: pipeline
|
||||
type: kubernetes
|
||||
name: linter
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: markdown lint
|
||||
commands:
|
||||
- markdownlint *.md
|
||||
image: docker.io/tmknom/markdownlint:0.23.1
|
||||
resources:
|
||||
limits:
|
||||
cpu: 50
|
||||
memory: 50M
|
||||
|
||||
- name: email-notification
|
||||
environment:
|
||||
PLUGIN_HOST:
|
||||
from_secret: smtp_host
|
||||
PLUGIN_USERNAME:
|
||||
from_secret: smtp_username
|
||||
PLUGIN_PASSWORD:
|
||||
from_secret: smtp_password
|
||||
PLUGIN_FROM:
|
||||
from_secret: smtp_mail_address
|
||||
image: docker.io/drillster/drone-email:latest
|
||||
resources:
|
||||
limits:
|
||||
cpu: 50
|
||||
memory: 25M
|
||||
when:
|
||||
status:
|
||||
- changed
|
||||
- failure
|
||||
|
||||
trigger:
|
||||
event:
|
||||
exclude:
|
||||
- tag
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: build
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: docker.io/volkerraschek/build-image:latest
|
||||
commands:
|
||||
- make container-image/build
|
||||
volumes:
|
||||
- name: docker_socket
|
||||
path: /var/run/docker.sock
|
||||
when:
|
||||
branch:
|
||||
- master
|
||||
|
||||
- name: push
|
||||
image: docker.io/volkerraschek/build-image:latest
|
||||
commands:
|
||||
- make container-image/push
|
||||
environment:
|
||||
DHCPD_IMAGE_REGISTRY_PASSWORD:
|
||||
from_secret: container_image_registry_password
|
||||
volumes:
|
||||
- name: docker_socket
|
||||
path: /var/run/docker.sock
|
||||
when:
|
||||
branch:
|
||||
- master
|
||||
repo:
|
||||
- volker.raschek/dhcpd-docker
|
||||
|
||||
- name: delete
|
||||
image: docker.io/volkerraschek/build-image:latest
|
||||
commands:
|
||||
- make container-image/delete
|
||||
volumes:
|
||||
- name: docker_socket
|
||||
path: /var/run/docker.sock
|
||||
when:
|
||||
branch:
|
||||
- master
|
||||
|
||||
- name: notify
|
||||
image: drillster/drone-email
|
||||
environment:
|
||||
PLUGIN_HOST:
|
||||
from_secret: smtp_host
|
||||
PLUGIN_USERNAME:
|
||||
from_secret: smtp_username
|
||||
PLUGIN_PASSWORD:
|
||||
from_secret: smtp_password
|
||||
PLUGIN_FROM:
|
||||
from_secret: smtp_mail_address
|
||||
when:
|
||||
status:
|
||||
- changed
|
||||
- failure
|
||||
|
||||
volumes:
|
||||
- name: docker_socket
|
||||
host:
|
||||
path: /var/run/docker.sock
|
||||
|
||||
trigger:
|
||||
event:
|
||||
exclude:
|
||||
- tag
|
||||
---
|
||||
kind: pipeline
|
||||
type: kubernetes
|
||||
name: sync
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: github
|
||||
image: docker.io/appleboy/drone-git-push:latest
|
||||
resources:
|
||||
limits:
|
||||
cpu: 50
|
||||
memory: 25M
|
||||
settings:
|
||||
branch: master
|
||||
remote: ssh://git@github.com/volker-raschek/dhcpd-docker.git
|
||||
force: true
|
||||
ssh_key:
|
||||
from_secret: ssh_key
|
||||
|
||||
- name: email-notification
|
||||
environment:
|
||||
PLUGIN_HOST:
|
||||
from_secret: smtp_host
|
||||
PLUGIN_USERNAME:
|
||||
from_secret: smtp_username
|
||||
PLUGIN_PASSWORD:
|
||||
from_secret: smtp_password
|
||||
PLUGIN_FROM:
|
||||
from_secret: smtp_mail_address
|
||||
image: docker.io/drillster/drone-email:latest
|
||||
resources:
|
||||
limits:
|
||||
cpu: 50
|
||||
memory: 25M
|
||||
when:
|
||||
status:
|
||||
- changed
|
||||
- failure
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- push
|
||||
repo:
|
||||
- volker.raschek/dhcpd-docker
|
12
.editorconfig
Normal file
12
.editorconfig
Normal file
@ -0,0 +1,12 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = false
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@ -0,0 +1 @@
|
||||
Makefile text eol=lf
|
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
.env
|
||||
data
|
||||
config
|
144
.markdownlint.yaml
Normal file
144
.markdownlint.yaml
Normal file
@ -0,0 +1,144 @@
|
||||
# markdownlint YAML configuration
|
||||
# https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.yaml
|
||||
|
||||
# Default state for all rules
|
||||
default: true
|
||||
|
||||
# Path to configuration file to extend
|
||||
extends: null
|
||||
|
||||
# MD003/heading-style/header-style - Heading style
|
||||
MD003:
|
||||
# Heading style
|
||||
style: "atx"
|
||||
|
||||
# MD004/ul-style - Unordered list style
|
||||
MD004:
|
||||
style: "dash"
|
||||
|
||||
# MD007/ul-indent - Unordered list indentation
|
||||
MD007:
|
||||
# Spaces for indent
|
||||
indent: 2
|
||||
# Whether to indent the first level of the list
|
||||
start_indented: false
|
||||
|
||||
# MD009/no-trailing-spaces - Trailing spaces
|
||||
MD009:
|
||||
# Spaces for line break
|
||||
br_spaces: 2
|
||||
# Allow spaces for empty lines in list items
|
||||
list_item_empty_lines: false
|
||||
# Include unnecessary breaks
|
||||
strict: false
|
||||
|
||||
# MD010/no-hard-tabs - Hard tabs
|
||||
MD010:
|
||||
# Include code blocks
|
||||
code_blocks: true
|
||||
|
||||
# MD012/no-multiple-blanks - Multiple consecutive blank lines
|
||||
MD012:
|
||||
# Consecutive blank lines
|
||||
maximum: 1
|
||||
|
||||
# MD013/line-length - Line length
|
||||
MD013:
|
||||
# Number of characters
|
||||
line_length: 80
|
||||
# Number of characters for headings
|
||||
heading_line_length: 80
|
||||
# Number of characters for code blocks
|
||||
code_block_line_length: 80
|
||||
# Include code blocks
|
||||
code_blocks: false
|
||||
# Include tables
|
||||
tables: false
|
||||
# Include headings
|
||||
headings: true
|
||||
# Include headings
|
||||
headers: true
|
||||
# Strict length checking
|
||||
strict: false
|
||||
# Stern length checking
|
||||
stern: false
|
||||
|
||||
# MD022/blanks-around-headings/blanks-around-headers - Headings should be surrounded by blank lines
|
||||
MD022:
|
||||
# Blank lines above heading
|
||||
lines_above: 1
|
||||
# Blank lines below heading
|
||||
lines_below: 1
|
||||
|
||||
# MD024/no-duplicate-heading/no-duplicate-header - Multiple headings with the same content
|
||||
MD024:
|
||||
# Only check sibling headings
|
||||
allow_different_nesting: true
|
||||
|
||||
# MD025/single-title/single-h1 - Multiple top-level headings in the same document
|
||||
MD025:
|
||||
# Heading level
|
||||
level: 1
|
||||
# RegExp for matching title in front matter
|
||||
front_matter_title: "^\\s*title\\s*[:=]"
|
||||
|
||||
# MD026/no-trailing-punctuation - Trailing punctuation in heading
|
||||
MD026:
|
||||
# Punctuation characters
|
||||
punctuation: ".,;:!。,;:!"
|
||||
|
||||
# MD029/ol-prefix - Ordered list item prefix
|
||||
MD029:
|
||||
# List style
|
||||
style: "one_or_ordered"
|
||||
|
||||
# MD030/list-marker-space - Spaces after list markers
|
||||
MD030:
|
||||
# Spaces for single-line unordered list items
|
||||
ul_single: 1
|
||||
# Spaces for single-line ordered list items
|
||||
ol_single: 1
|
||||
# Spaces for multi-line unordered list items
|
||||
ul_multi: 1
|
||||
# Spaces for multi-line ordered list items
|
||||
ol_multi: 1
|
||||
|
||||
# MD033/no-inline-html - Inline HTML
|
||||
MD033:
|
||||
# Allowed elements
|
||||
allowed_elements: []
|
||||
|
||||
# MD035/hr-style - Horizontal rule style
|
||||
MD035:
|
||||
# Horizontal rule style
|
||||
style: "---"
|
||||
|
||||
# MD036/no-emphasis-as-heading/no-emphasis-as-header - Emphasis used instead of a heading
|
||||
MD036:
|
||||
# Punctuation characters
|
||||
punctuation: ".,;:!?。,;:!?"
|
||||
|
||||
# MD041/first-line-heading/first-line-h1 - First line in a file should be a top-level heading
|
||||
MD041:
|
||||
# Heading level
|
||||
level: 1
|
||||
# RegExp for matching title in front matter
|
||||
front_matter_title: "^\\s*title\\s*[:=]"
|
||||
|
||||
# MD044/proper-names - Proper names should have the correct capitalization
|
||||
MD044:
|
||||
# List of proper names
|
||||
names: []
|
||||
# - some-thing
|
||||
# Include code blocks
|
||||
code_blocks: false
|
||||
|
||||
# MD046/code-block-style - Code block style
|
||||
MD046:
|
||||
# Block style
|
||||
style: "fenced"
|
||||
|
||||
# MD048/code-fence-style - Code fence style
|
||||
MD048:
|
||||
# Code fence syle
|
||||
style: "backtick"
|
7
Dockerfile
Normal file
7
Dockerfile
Normal file
@ -0,0 +1,7 @@
|
||||
FROM docker.io/library/archlinux:latest
|
||||
|
||||
RUN pacman --sync --sysupgrade --refresh --noconfirm dhcp
|
||||
|
||||
ADD rootfs/ .
|
||||
|
||||
ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]
|
13
LICENSE
Normal file
13
LICENSE
Normal file
@ -0,0 +1,13 @@
|
||||
Copyright 2019 Markus Pesch
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
47
Makefile
Normal file
47
Makefile
Normal file
@ -0,0 +1,47 @@
|
||||
# CONTAINER_RUNTIME
|
||||
# The CONTAINER_RUNTIME variable will be used to specified the path to a
|
||||
# container runtime. This is needed to start and run a container image.
|
||||
CONTAINER_RUNTIME?=$(shell which docker)
|
||||
|
||||
# DHCPD_IMAGE_REGISTRY_NAME
|
||||
# Defines the name of the new container to be built using several variables.
|
||||
DHCPD_IMAGE_REGISTRY_NAME:=docker.io
|
||||
DHCPD_IMAGE_REGISTRY_USER:=volkerraschek
|
||||
|
||||
DHCPD_IMAGE_NAMESPACE?=${DHCPD_IMAGE_REGISTRY_USER}
|
||||
DHCPD_IMAGE_NAME:=dhcpd
|
||||
DHCPD_IMAGE_VERSION?=latest
|
||||
DHCPD_IMAGE_FULLY_QUALIFIED=${DHCPD_IMAGE_REGISTRY_NAME}/${DHCPD_IMAGE_NAMESPACE}/${DHCPD_IMAGE_NAME}:${DHCPD_IMAGE_VERSION}
|
||||
DHCPD_IMAGE_UNQUALIFIED=${DHCPD_IMAGE_NAMESPACE}/${DHCPD_IMAGE_NAME}:${DHCPD_IMAGE_VERSION}
|
||||
|
||||
# BUILD CONTAINER IMAGE
|
||||
# ==============================================================================
|
||||
PHONY:=container-image/build
|
||||
container-image/build:
|
||||
${CONTAINER_RUNTIME} build \
|
||||
--file Dockerfile \
|
||||
--no-cache \
|
||||
--pull \
|
||||
--tag ${DHCPD_IMAGE_FULLY_QUALIFIED} \
|
||||
--tag ${DHCPD_IMAGE_UNQUALIFIED} \
|
||||
.
|
||||
|
||||
# DELETE CONTAINER IMAGE
|
||||
# ==============================================================================
|
||||
PHONY:=container-image/delete
|
||||
container-image/delete:
|
||||
- ${CONTAINER_RUNTIME} image rm ${DHCPD_IMAGE_FULLY_QUALIFIED} ${DHCPD_IMAGE_UNQUALIFIED}
|
||||
- ${CONTAINER_RUNTIME} image rm ${BASE_IMAGE_FULL}
|
||||
|
||||
# PUSH CONTAINER IMAGE
|
||||
# ==============================================================================
|
||||
PHONY+=container-image/push
|
||||
container-image/push:
|
||||
echo ${DHCPD_IMAGE_REGISTRY_PASSWORD} | ${CONTAINER_RUNTIME} login ${DHCPD_IMAGE_REGISTRY_NAME} --username ${DHCPD_IMAGE_REGISTRY_USER} --password-stdin
|
||||
${CONTAINER_RUNTIME} push ${DHCPD_IMAGE_FULLY_QUALIFIED}
|
||||
|
||||
# PHONY
|
||||
# ==============================================================================
|
||||
# Declare the contents of the PHONY variable as phony. We keep that information
|
||||
# in a variable so we can use it in if_changed.
|
||||
.PHONY: ${PHONY}
|
47
README.md
Normal file
47
README.md
Normal file
@ -0,0 +1,47 @@
|
||||
# dhcpd-docker
|
||||
|
||||
[![Build Status](https://drone.cryptic.systems/api/badges/volker.raschek/dhcpd-docker/status.svg)](https://drone.cryptic.systems/volker.raschek/dhcpd-docker)
|
||||
[![Docker Pulls](https://img.shields.io/docker/pulls/volkerraschek/dhcpd)](https://hub.docker.com/r/volkerraschek/dhcpd)
|
||||
|
||||
This project contains all sources to build the container image
|
||||
`docker.io/volkerraschek/dhcpd`. The primary goal of the image is to run the
|
||||
ISC-DHCPD server inside a container to support distributions which does not
|
||||
deploy a newer version of the DHCP server.
|
||||
|
||||
## Usage
|
||||
|
||||
### IPv4 (default)
|
||||
|
||||
```bash
|
||||
$ docker run \
|
||||
--env DHCP_INTERFACES=br0 \
|
||||
--env DHCP_IP=4 \
|
||||
--rm \
|
||||
--volume ${PWD}/config:/etc/dhcp:ro \
|
||||
--volume ${PWD}/data:/var/lib/dhcp:rw \
|
||||
--volume /etc/localtime:/etc/localtime:ro \
|
||||
volkerraschek/dhcpd-docker:latest
|
||||
```
|
||||
|
||||
### IPv6
|
||||
|
||||
```bash
|
||||
$ docker run \
|
||||
--env DHCP_INTERFACES=br0 \
|
||||
--env DHCP_IP=4 \
|
||||
--rm \
|
||||
--volume ${PWD}/config:/etc/dhcpd:ro \
|
||||
--volume ${PWD}/data:/var/lib/dhcp:rw \
|
||||
--volume /etc/localtime:/etc/localtime:ro \
|
||||
volkerraschek/dhcpd-docker:latest
|
||||
```
|
||||
|
||||
## Build image manually
|
||||
|
||||
To build the images manually check out the
|
||||
[repository](https://drone.cryptic.systems/volker.raschek/dhcpd-docker) with
|
||||
`git` and use the `make` command to build the container images.
|
||||
|
||||
```bash
|
||||
make container-image/build
|
||||
```
|
13
docker-compose.yml
Normal file
13
docker-compose.yml
Normal file
@ -0,0 +1,13 @@
|
||||
version: "3"
|
||||
services:
|
||||
dhcpd:
|
||||
container_name: dhcpd
|
||||
environment:
|
||||
- DHCP_INTERFACES=br0
|
||||
- DHCP_IP=4
|
||||
image: volkerraschek/dhcpd-docker:latest
|
||||
network_mode: host
|
||||
volumes:
|
||||
- ${PWD}/config:/etc/dhcp:ro
|
||||
- ${PWD}/data:/var/lib/dhcp:rw
|
||||
- /etc/localtime:/etc/localtime:ro
|
11
rootfs/usr/local/bin/entrypoint.sh
Executable file
11
rootfs/usr/local/bin/entrypoint.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
mkdir --parents /etc/dhcp/ mkdir --parents /run/dhcpd{4,6} || true
|
||||
|
||||
if [ "${DHCP_IP+x}" = "x" ] && [ ${DHCP_IP} == "6" ]; then
|
||||
touch /var/lib/dhcp/dhcpd6.leases
|
||||
/usr/bin/dhcpd -6 -cf /etc/dhcp/dhcpd6.conf -pf /run/dhcpd6/dhcpd.pid -d ${DHCP_INTERFACES}
|
||||
else
|
||||
touch /var/lib/dhcp/dhcpd.leases
|
||||
/usr/bin/dhcpd -4 -cf /etc/dhcp/dhcpd.conf -pf /run/dhcpd4/dhcpd.pid -d ${DHCP_INTERFACES}
|
||||
fi
|
Loading…
Reference in New Issue
Block a user