-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
68 lines (60 loc) · 2.99 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# =============================================================================
# Dockerfile
# Bind Name Server Container
# https://github.com/aessing/bind-container
# -----------------------------------------------------------------------------
# Developer.......: Andre Essing (https://github.com/aessing)
# (https://www.linkedin.com/in/aessing/)
# -----------------------------------------------------------------------------
# THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
# EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
# =============================================================================
###############################################################################
# Get the base Linux image
FROM alpine:3.20.3
###############################################################################
# Set parameters
ARG BUILD_DATE
ENV TZ='UTC'
EXPOSE 53/tcp \
53/udp \
80/tcp \
443/tcp \
853/tcp
VOLUME ["/etc/bind", "/var/lib/bind"]
###############################################################################
# Set some information
LABEL org.opencontainers.image.created=${BUILD_DATE} \
org.opencontainers.image.authors="Andre Essing" \
org.opencontainers.image.description="BIND is an open source DNS software system including an authoritative server or a recursive resolver." \
org.opencontainers.image.documentation="https://github.com/aessing/bind-container" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.title="Bind Name Server Container" \
org.opencontainers.image.url="https://github.com/aessing/bind-container" \
org.opencontainers.image.vendor="Andre Essing"
################################################### ############################
# Install chronyd and necessary packages
RUN apk --update --no-cache upgrade \
&& apk add --update --no-cache bind ca-certificates tzdata \
&& rm -rf /var/cache/apk/* \
&& update-ca-certificates \
&& cp /usr/share/zoneinfo/${TZ} /etc/localtime \
&& echo $TZ > /etc/timezone \
&& mkdir -p /etc/bind /var/lib/bind /var/cache/bind \
&& chown -R named:named /etc/bind /var/lib/bind \
&& chown -R root:named /var/cache/bind \
&& chmod -R u+rw,g+rw,o-rwx /var/cache/bind /var/lib/bind \
&& chmod -R u+rw,g+w,g-w,o-rwx /etc/bind
###############################################################################
# Copy files
COPY container-files/named.conf /etc/bind/named.conf
COPY container-files/db.* /var/lib/bind/zones/
###############################################################################
# Run in non-root context
USER named
###############################################################################
# Start chronyd
CMD [ "/usr/sbin/named", "-g", "-u", "named", "-c", "/etc/bind/named.conf" ]
###############################################################################
#EOF