forked from klzgrad/naiveproxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
56 lines (47 loc) · 1.77 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
FROM --platform=${TARGETPLATFORM} debian:stable-slim as downloader
WORKDIR /root
ARG TARGETPLATFORM
ARG VERSION
RUN set -eux; \
apt-get update; \
apt-get install -y wget binutils xz-utils; \
case "${TARGETPLATFORM}" in \
'linux/386') \
ARCH="linux-x86"; \
;; \
'linux/amd64') \
ARCH="linux-x64"; \
;; \
'linux/arm/v7') \
ARCH="linux-arm"; \
;; \
'linux/arm64'|'linux/arm64/v8') \
ARCH="linux-arm64"; \
;; \
*) echo >&2 "error: unsupported architecture '$arch' (likely packaging update needed)"; exit 1 ;; \
esac; \
\
export NAIVE_FILE="naiveproxy-${VERSION}-${ARCH}"; \
\
echo "Downloading compressed release file..."; \
wget -O /root/naive.tar.xz https://github.com/0xf00f00/naiveproxy/releases/download/${VERSION}/${NAIVE_FILE}.tar.xz > /dev/null 2>&1; \
if [ ! -f /root/naive.tar.xz ]; then \
echo "Error: Failed to download compressed release file!"; exit 1; \
fi; \
echo "Download compressed release file completed."; \
\
mkdir -p /root/naive; \
\
echo "Extracting release file"; \
tar -xf /root/naive.tar.xz -C /root; \
mv /root/${NAIVE_FILE}/naive /root/naive/naive; \
mv /root/${NAIVE_FILE}/config.json /root/naive/config.json; \
chmod +x /root/naive/naive; \
strip -s /root/naive/naive; \
echo "Extracting release file: completed.";
FROM --platform=${TARGETPLATFORM} debian:stable-slim
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates
VOLUME /etc/naiveproxy
COPY --from=downloader /root/naive/naive /usr/bin/naive
COPY --from=downloader /root/naive/config.json /etc/naiveproxy/config.json
CMD [ "/usr/bin/naive", "/etc/naiveproxy/config.json" ]