소스 검색

add dockerfile, docker compose config and caddy config template

Readme document as well, of course.

Signed-off-by: greatbridf <greatbridf@icloud.com>
greatbridf 2 일 전
커밋
9330ea748b
5개의 변경된 파일98개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      .gitignore
  2. 30 0
      Caddyfile.template
  3. 20 0
      Dockerfile
  4. 23 0
      README.md
  5. 22 0
      docker-compose.yml

+ 3 - 0
.gitignore

@@ -0,0 +1,3 @@
+conf/
+data/
+log/

+ 30 - 0
Caddyfile.template

@@ -0,0 +1,30 @@
+{
+	order forward_proxy before file_server
+	order forward_proxy before error
+	email ##YOUR EMAIL HERE##
+	storage file_system /data
+	log {
+		output file /log/caddy.log {
+			roll_size 10mb
+			roll_keep 3
+		}
+	}
+}
+
+:443, ##YOUR DOMAIN HERE## {
+	forward_proxy {
+		hide_ip
+		hide_via
+		probe_resistance
+		basic_auth ##USERNAME## ##PASSWORD##
+	}
+
+	error /* "Bad Request" 400
+	log {
+		output file /log/proxy.log {
+			roll_size 10mb
+			roll_keep 10
+			roll_keep_for 720h
+		}
+	}
+}

+ 20 - 0
Dockerfile

@@ -0,0 +1,20 @@
+FROM alpine:3.21 AS download
+ARG CLIENT=https://github.com/klzgrad/forwardproxy/releases/download/v2.10.0-naive/caddy-forwardproxy-naive.tar.xz
+
+RUN set -eux && \
+	mkdir /tmp/build && \
+	cd /tmp/build && \
+	wget -O forwardproxy.tar.xz "$CLIENT" && \
+	tar xf forwardproxy.tar.xz && \
+	mv caddy-forwardproxy-naive/caddy /caddy
+
+FROM alpine:3.21 AS app
+
+EXPOSE 80 443 443/udp
+VOLUME [ "/conf", "/data", "/log" ]
+
+WORKDIR /app
+
+COPY --from=download /caddy /app/caddy
+
+ENTRYPOINT [ "/app/caddy", "run", "--config", "/conf/Caddyfile", "--adapter", "caddyfile" ]

+ 23 - 0
README.md

@@ -0,0 +1,23 @@
+# naiveproxy server encapsulated
+
+# Usage
+
+First, copy `Caddyfile.template` to `conf/Caddyfile` and edit your configuration manually.
+
+You would need to fill in your email (used to applying for TLS certs), your domain and
+your username and password for authentification. Alternatively, you can drop your other
+web services (such as static pages and reverse proxies) here.
+
+Then, you can run:
+
+```shell
+docker run --rm -p 80:80 -p 443:443 -p 443:443/udp \
+	-v ./conf:/conf -v ./data:/data -v ./log:/log \
+	--name naiveserver naiveserver
+```
+
+or you can use docker compose:
+
+```shell
+docker-compose up -d
+```

+ 22 - 0
docker-compose.yml

@@ -0,0 +1,22 @@
+services:
+  naiveserver:
+    image: localhost/naiveserver:1.0.0
+    restart: unless-stopped
+    environment: []
+    volumes:
+      - ./conf:/conf
+      - ./data:/data
+      - ./log:/log
+    networks:
+      - net
+    ports:
+      - "80:80"
+      - "443:443"
+      - "443:443/udp"
+    cap_add:
+      - NET_ADMIN
+
+networks:
+  net:
+    driver: bridge
+    enable_ipv6: true