-
Notifications
You must be signed in to change notification settings - Fork 42
/
Dockerfile
67 lines (58 loc) · 1.34 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
FROM alpine:3.12
LABEL maintainer="[email protected]"
ENV NUT_VERSION 2.7.4
ENV UPS_NAME="ups"
ENV UPS_DESC="UPS"
ENV UPS_DRIVER="usbhid-ups"
ENV UPS_PORT="auto"
ENV API_PASSWORD=""
ENV ADMIN_PASSWORD=""
ENV SHUTDOWN_CMD="echo 'System shutdown not configured!'"
RUN set -ex; \
# run dependencies
apk add --no-cache \
openssh-client \
libusb-compat \
; \
# build dependencies
apk add --no-cache --virtual .build-deps \
libusb-compat-dev \
build-base \
; \
# download and extract
cd /tmp; \
wget http://www.networkupstools.org/source/2.7/nut-$NUT_VERSION.tar.gz; \
tar xfz nut-$NUT_VERSION.tar.gz; \
cd nut-$NUT_VERSION \
; \
# build
./configure \
--prefix=/usr \
--sysconfdir=/etc/nut \
--disable-dependency-tracking \
--enable-strip \
--disable-static \
--with-all=no \
--with-usb=yes \
--datadir=/usr/share/nut \
--with-drvpath=/usr/share/nut \
--with-statepath=/var/run/nut \
--with-user=nut \
--with-group=nut \
; \
# install
make install \
; \
# create nut user
adduser -D -h /var/run/nut nut; \
chgrp -R nut /etc/nut; \
chmod -R o-rwx /etc/nut; \
install -d -m 750 -o nut -g nut /var/run/nut \
; \
# cleanup
rm -rf /tmp/nut-$NUT_VERSION.tar.gz /tmp/nut-$NUT_VERSION; \
apk del .build-deps
COPY src/docker-entrypoint /usr/local/bin/
ENTRYPOINT ["docker-entrypoint"]
WORKDIR /var/run/nut
EXPOSE 3493