-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
92 lines (76 loc) · 2.89 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
# MAIN BUILDER
FROM debian:bookworm-slim AS builder
ENV NODEJS_MAJOR=20
ARG DEBIAN_FRONTEND=noninteractive
LABEL MAINTAINER="Hutu Tech | imashen"
LABEL Description="ZEROTIER ONE + ZEROTIER WEB UI"
# BUILD zerotier-webui IN FIRST STAGE
WORKDIR /build
RUN apt update -y && \
apt install -y --no-install-recommends \
curl gnupg2 ca-certificates zip unzip build-essential git gcc make && \
curl -sL https://deb.nodesource.com/setup_${NODEJS_MAJOR}.x | bash - && \
apt install -y --no-install-recommends nodejs
COPY zerotier-webui ./zerotier-webui
RUN cd zerotier-webui/src && \
npm install -g node-gyp @yao-pkg/pkg && \
npm install && \
npm run build && \
zip -r /build/artifact.zip webui node_modules/argon2/build/Release && \
apt clean && rm -rf /var/lib/apt/lists/*
WORKDIR /generator
COPY generator/ .
RUN chmod 0755 attic/world/build.sh
RUN cd attic/world && \
./build.sh
# BUILD GO UTILS
FROM golang:1.23-bookworm AS utilsbuilder
WORKDIR /buildsrc
COPY plugins/argon2g /buildsrc/argon2g
COPY plugins/fileserv /buildsrc/fileserv
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:bookworm-slim AS runner
RUN apt update -y && \
apt install -y --no-install-recommends \
curl gnupg2 ca-certificates unzip supervisor net-tools procps && \
groupadd -g 2222 zerotier-one && \
useradd -u 2222 -g 2222 zerotier-one && \
curl -sL https://install.zerotier.com | bash && \
apt clean && rm -rf /var/lib/apt/lists/*
WORKDIR /www/zerotier-webui
COPY --from=builder /build/artifact.zip .
RUN unzip ./artifact.zip && rm -f ./artifact.zip
COPY --from=utilsbuilder /buildsrc/binaries/* /usr/local/bin/
COPY --from=builder /generator/attic/world/bin/* /usr/local/bin/
WORKDIR /initfiles
COPY initfiles/origin-planet.json ./origin-planet.json
COPY initfiles/README ./README
WORKDIR /var/lib/zerotier-one
COPY initfiles/origin-planet.json ./origin-planet.json
COPY start_zerotierone.sh /start_zerotierone.sh
COPY start_zerotier-webui.sh /start_zerotier-webui.sh
COPY supervisord.conf /etc/supervisord.conf
RUN chmod 0755 /usr/local/bin/* && \
chmod 0755 /start_*.sh && \
mkdir -p /logs && \
chown -R zerotier-one:zerotier-one /logs
# EXPOSE 3000/tcp 3180/tcp 3443/tcp 9993/udp
# VOLUME ["/www/zerotier-webui/etc", "/var/lib/zerotier-one", "/logs"]
ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]