forked from warewulf/warewulf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
94 lines (83 loc) · 3.32 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
FROM opensuse/tumbleweed:latest as builder
RUN zypper -n install --no-recommends git go1.18 libgpgme-devel &&\
zypper -n install -t pattern devel_basis
# now build the warewulf
COPY . /warewulf-src
RUN cd /warewulf-src &&\
make clean \
OFFLINE_BUILD=1 &&\
make defaults \
PREFIX=/usr \
BINDIR=/usr/bin \
SYSCONFDIR=/etc \
DATADIR=/usr/share \
LOCALSTATEDIR=/var/lib \
SHAREDSTATEDIR=/var/lib \
MANDIR=/usr/share/man \
INFODIR=/usr/share/info \
DOCDIR=/usr/share/doc \
SRVDIR=/var/lib \
TFTPDIR=/srv/tftpboot \
SYSTEMDDIR=/usr/lib/systemd/system \
BASHCOMPDIR=/etc/warewulf/bash_completion.d/ \
FIREWALLDDIR=/usr/lib/firewalld/services \
WWCLIENTDIR=/warewulf &&\
make lint &&\
make &&\
make install
# now all again but just the bare install for running the stuff
FROM opensuse/tumbleweed:latest
LABEL Description="Warewulf Base Container"
LABEL maintainer="Christian Goll <cgoll@suse.com>"
COPY --from=builder /usr/bin/wwctl /usr/bin/wwctl
COPY --from=builder /var/lib/warewulf /var/lib/warewulf
COPY --from=builder /usr/share/warewulf /usr/share/warewulf
COPY --from=builder /usr/lib/systemd/system/warewulfd.service /container-scripts/warewulfd.service
COPY --from=builder /etc/warewulf /etc/warewulf
COPY --from=builder /warewulf-src/container-scripts /container-scripts
RUN zypper -n install \
cpio \
gzip \
pigz \
rsync \
openssh-clients \
less \
dhcp-server \
iproute2 \
vim \
yq \
tftp \
systemd \
&& \
zypper clean -a && \
systemctl enable dhcpd && \
systemctl enable tftp.socket &&\
export DHCPDCONF=/etc/sysconfig/dhcpd; test -e $DHCPDCONF && \
sed -i 's/^DHCPD_INTERFACE=""/DHCPD_INTERFACE="ANY"/' $DHCPDCONF && \
sed -i 's/^DHCPD_RUN_CHROOTED="yes"/DHCPD_RUN_CHROOTED="no"/' $DHCPDCONF && \
WW4CONF=/etc/warewulf/warewulf.conf; test -e $WW4CONF && \
yq e '.ipaddr |= "EMPTY"' -i $WW4CONF && \
yq e '.netmask |= "EMPTY"' -i $WW4CONF && \
yq e '.network |= "EMPTY"' -i $WW4CONF && \
yq e '.dhcp.["range start"] |= "EMPTY"' -i $WW4CONF && \
yq e '.dhcp.["range end"] |= "EMPTY"' -i $WW4CONF && \
yq e '.nfs.enabled |= false' -i $WW4CONF && \
mkdir -p /container && \
cp -vr container-scripts/label-* \
container-scripts/wwctl \
container-scripts/warewulf.service \
container-scripts/warewulf-container-manage.sh \
container-scripts/config-warewulf \
/container &&\
mkdir -p /usr/share/bash_completion/completions/ &&\
cp /etc/warewulf/bash_completion.d/warewulf /usr/share/bash_completion/completions/warewulf &&\
mv -v container-scripts/ww4-config.service /etc/systemd/system/ &&\
mv -v container-scripts/warewulfd.service /etc/systemd/system/ &&\
systemctl enable ww4-config &&\
systemctl enable warewulfd
CMD [ "/usr/sbin/init" ]
EXPOSE 67/udp 68/udp 69/udp 80 9873
LABEL INSTALL="/usr/bin/docker run --env IMAGE=IMAGE --rm --privileged -v /:/host IMAGE /bin/bash /container/label-install"
LABEL UNINSTALL="/usr/bin/docker run --rm --privileged -v /:/host IMAGE /bin/bash /container/label-uninstall"
LABEL PURGE="/usr/bin/docker run -ti --rm --privileged -v /:/host IMAGE /bin/bash /container/label-purge"
LABEL RUN="/usr/bin/docker run -d --replace --name \${NAME} --privileged --net=host -v /:/host -v /etc/warewulf:/etc/warewulf -v /var/lib/warewulf/:/var/lib/warewulf/ -e NAME=\${NAME} -e IMAGE=\${IMAGE} \${IMAGE}"