-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
91 lines (80 loc) · 2.98 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
FROM debian:bullseye-slim AS builder
ENV NODEJS_MAJOR=16
ARG DEBIAN_FRONTEND=noninteractive
LABEL MAINTAINER="Codesec Networks https://codesecure.in"
LABEL Description="codesec (a Codesec network controller user interface) + Codesec network controller"
ADD VERSION .
# BUILD ZTNCUI IN FIRST STAGE
WORKDIR /build
RUN apt update -y && \
apt install curl gnupg2 ca-certificates zip unzip build-essential git --no-install-recommends -y && \
curl -sL -o node_inst.sh https://deb.nodesource.com/setup_${NODEJS_MAJOR}.x && \
bash node_inst.sh && \
apt install -y nodejs --no-install-recommends && \
rm -f node_inst.sh && \
git clone https://github.com/navein-kumar/ztncui && \
npm install -g node-gyp pkg && \
cd ztncui/src && \
npm install && \
pkg -c ./package.json -t "node${NODEJS_MAJOR}-linux-x64" bin/www -o ztncui && \
zip -r /build/artifact.zip ztncui node_modules/argon2/build/Release
# BUILD GO UTILS
FROM golang:bullseye AS argong
WORKDIR /buildsrc
COPY argon2g /buildsrc/argon2g
COPY fileserv /buildsrc/fileserv
ENV CGO_ENABLED=0
RUN mkdir -p binaries && \
cd argon2g && \
go mod download && \
go build -ldflags='-s -w' -trimpath -o ../binaries/argon2g && \
cd .. && \
git clone https://github.com/jsha/minica && \
cd minica && \
go mod download && \
go build -ldflags='-s -w' -trimpath -o ../binaries/minica && \
cd .. && \
git clone https://github.com/tianon/gosu && \
cd gosu && \
go mod download && \
go build -o ../binaries/gosu -ldflags='-s -w' -trimpath && \
cd .. && \
cd fileserv && \
go build -ldflags='-s -w' -trimpath -o ../binaries/fileserv main.go
# START RUNNER
FROM debian:bullseye-slim AS runner
RUN apt update -y && \
apt install curl gnupg2 ca-certificates unzip supervisor net-tools procps --no-install-recommends -y && \
groupadd -g 2222 zerotier-one && \
useradd -u 2222 -g 2222 zerotier-one && \
curl -sL -o ztone.sh https://install.zerotier.com && \
bash ztone.sh && \
rm -f ztone.sh && \
apt clean -y && \
rm -rf /var/lib/zerotier-one && \
rm -rf /var/lib/apt/lists/*
WORKDIR /opt/key-networks/ztncui
COPY --from=builder /build/artifact.zip .
RUN unzip ./artifact.zip && \
rm -f ./artifact.zip
COPY --from=argong /buildsrc/binaries/gosu /bin/gosu
COPY --from=argong /buildsrc/binaries/minica /usr/local/bin/minica
COPY --from=argong /buildsrc/binaries/argon2g /usr/local/bin/argon2g
COPY --from=argong /buildsrc/binaries/fileserv /usr/local/bin/gfileserv
COPY start_zt1.sh /start_zt1.sh
COPY start_ztncui.sh /start_ztncui.sh
COPY supervisord.conf /etc/supervisord.conf
RUN chmod 0755 /bin/gosu && \
chmod 0755 /usr/local/bin/minica && \
chmod 0755 /usr/local/bin/argon2g && \
chmod 0755 /usr/local/bin/gfileserv && \
chmod 0755 /start_*.sh
EXPOSE 3000/tcp
EXPOSE 3180/tcp
EXPOSE 8000/tcp
EXPOSE 3443/tcp
EXPOSE 9993/udp
WORKDIR /
VOLUME ["/opt/key-networks/ztncui/etc"]
VOLUME [ "/var/lib/zerotier-one" ]
ENTRYPOINT [ "/usr/bin/supervisord" ]