initial commit
This commit is contained in:
commit
0b80fb9a4a
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
.env
|
||||||
|
tmp/
|
15
Dockerfile
Normal file
15
Dockerfile
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
ARG VERSION
|
||||||
|
FROM registry.opensuse.org/opensuse/tumbleweed:${VERSION}
|
||||||
|
|
||||||
|
VOLUME /config
|
||||||
|
|
||||||
|
|
||||||
|
RUN zypper --non-interactive install --no-recommends \
|
||||||
|
dnsmasq \
|
||||||
|
&& zypper clean -a \
|
||||||
|
rm /var/log/zypper.log
|
||||||
|
|
||||||
|
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||||
|
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||||
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||||
|
CMD ["start"]
|
25
Makefile
Normal file
25
Makefile
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
.PHONY: default build clean release
|
||||||
|
|
||||||
|
-include .env
|
||||||
|
|
||||||
|
VERSION=20230411
|
||||||
|
IMAGENAME=dnsmasq
|
||||||
|
REPO=docker.io/bardak
|
||||||
|
|
||||||
|
SHELL := /bin/bash
|
||||||
|
|
||||||
|
default: build
|
||||||
|
|
||||||
|
guard:
|
||||||
|
@ if [ -z "$(git status --porcelain)" ]; then echo "git repo not clean"; exit 1; fi
|
||||||
|
|
||||||
|
build:
|
||||||
|
podman build --build-arg VERSION=$(VERSION) --tag ${REPO}/${IMAGENAME}:$(VERSION) .
|
||||||
|
|
||||||
|
clean:
|
||||||
|
podman image rm ${REPO}/${IMAGENAME}:$(VERSION)
|
||||||
|
|
||||||
|
release: guard clean build
|
||||||
|
git tag v$(VERSION)
|
||||||
|
git push origin v$(VERSION)
|
||||||
|
podman push --creds $(USERNAME):$(PASSWORD) ${REPO}/${IMAGENAME}:$(VERSION)
|
30
entrypoint.sh
Normal file
30
entrypoint.sh
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if [[ ! -f /config/dnsmasq.conf ]]; then
|
||||||
|
echo "* Creating /config/dnsmasq.conf"
|
||||||
|
sed 's/^conf-dir=\/etc\//conf-dir=\/config\//g' /etc/dnsmasq.conf > /config/dnsmasq.conf
|
||||||
|
fi
|
||||||
|
if [[ ! -f /config/hosts/hosts ]]; then
|
||||||
|
echo "* Creating /config/hosts/hosts"
|
||||||
|
mkdir /config/hosts
|
||||||
|
cp /etc/hosts /config/hosts/hosts
|
||||||
|
fi
|
||||||
|
if [[ ! -f /config/resolv.conf ]]; then
|
||||||
|
echo "* Creating /config/resolv.conf"
|
||||||
|
cp /etc/resolv.conf /config/resolv.conf
|
||||||
|
fi
|
||||||
|
if [[ ! -d /config/dnsmasq.d ]]; then
|
||||||
|
echo "* Creating /config/dnsmasq.d"
|
||||||
|
mkdir /config/dnsmasq.d
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$1" == "start" ]]; then
|
||||||
|
/usr/sbin/dnsmasq \
|
||||||
|
--conf-fil=/config/dnsmasq.conf \
|
||||||
|
--no-daemon --no-hosts \
|
||||||
|
--keep-in-foreground \
|
||||||
|
--resolv-file=/config/resolv.conf \
|
||||||
|
--hostsdir=/config/hosts
|
||||||
|
else
|
||||||
|
exec "$@"
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user