-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
59 lines (47 loc) · 1.23 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
FROM golang:alpine AS builder
WORKDIR /apps
RUN apk add --no-cache git
RUN git clone https://github.com/wy2919/go-network-monitor.git .
RUN go mod init main && go mod tidy
RUN go build -o /apps/main /apps/main.go
FROM alpine:latest
WORKDIR /apps
COPY --from=builder /apps/main .
RUN apk update && apk add --no-cache openssh-client sshpass dbus tzdata && mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2 && chmod +x main
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone
ENV INTERVAL=30 \
PARDON=600 \
NAME="" \
HOST="" \
MODEL=1 \
GB=1000000 \
INTERFACE="ens4" \
WXKEY="" \
SHUTDOWN="no" \
SHUTDOWNTYPE="dbus" \
SSHHOST="" \
SSHPWD="" \
SSHPORT=22 \
SSHRUN="shutdown -h now" \
SMTPHOST="smtp.qq.com:587" \
SMTPEMAIL="" \
SMTPPWD=""
CMD ./main \
-interval $INTERVAL \
-pardon $PARDON \
-name $NAME \
-host $HOST \
-model $MODEL \
-gb $GB \
-interface $INTERFACE \
-wxKey $WXKEY \
-shutdown $SHUTDOWN \
-shutdownType $SHUTDOWNTYPE \
-sshHost $SSHHOST \
-sshPwd $SSHPWD \
-sshPort $SSHPORT \
-sshRun $SSHRUN \
-smtpHost $SMTPHOST \
-smtpEmail $SMTPEMAIL \
-smtpPwd $SMTPPWD