1
0
Fork 0

Optimized Dockerfile

This commit is contained in:
Eros Nardi 2021-01-08 23:55:53 +01:00
parent 00290a8b91
commit 482b0bf46e
2 changed files with 10 additions and 9 deletions

View File

@ -7,8 +7,17 @@ ENV POLLFREQ 5
ENV DESC UPS ENV DESC UPS
ENV USERSSTRING # ENV USERSSTRING #
#Installing default packages
RUN apt-get update RUN apt-get update
RUN apt-get -y install nut-server RUN apt-get install -y \
nut-server
#Apply configuration
RUN sed -i 's/MODE=none/MODE=netserver/g' /etc/nut/nut.conf \
&& echo "LISTEN 0.0.0.0 3493" >> /etc/nut/upsd.conf \
&& echo -e "[$NAME] \n driver = $DRIVER \n port = $PORT \n pollfreq = $POLLFREQ \n desc = $DESC" >> /etc/nut/ups.conf \
&& echo -e "$USERSSTRING" >> /etc/nut/upsd.users \
&& chgrp nut /etc/nut/*
COPY entrypoint.sh / COPY entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]

View File

@ -1,13 +1,5 @@
#!/bin/bash #!/bin/bash
sed -i 's/MODE=none/MODE=netserver/g' /etc/nut/nut.conf
echo "LISTEN 0.0.0.0 3493" >> /etc/nut/upsd.conf
echo -e "[$NAME] \n driver = $DRIVER \n port = $PORT \n pollfreq = $POLLFREQ \n desc = $DESC" >> /etc/nut/ups.conf
echo -e "$USERSSTRING" >> /etc/nut/upsd.users
chgrp nut /etc/nut/*
chgrp nut /dev/bus/usb/*/* chgrp nut /dev/bus/usb/*/*
upsdrvctl start upsdrvctl start
exec upsd -D exec upsd -D