diff --git a/docker_overtls_caddy/Dockerfile b/docker_overtls_caddy/Dockerfile new file mode 100644 index 0000000..22e2881 --- /dev/null +++ b/docker_overtls_caddy/Dockerfile @@ -0,0 +1,38 @@ +FROM alpine:3.17 + + +ENV TUNNEL_PATH=/secret-tunnel-path/ \ + OVERTLS_LOG_LEVEL=debug \ + HTTPS_PORT=443 \ + OVERTLS_HOST=127.0.0.1 \ + OVERTLS_PORT=10000 \ + CADDY_VERSION=2.7.6 \ + BASE_PATH="/etc/s6-overlay/s6-rc.d" \ + DOMAIN_NAME="" \ + S6_OVERLAY_VERSION="3.2.0.2" + +COPY --chmod=755 ./rootfs / + +RUN apk update && apk add --no-cache unzip wget bash curl && \ + wget -O /tmp/s6-overlay-noarch.tar.xz https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz && \ + tar -C / -Jxf /tmp/s6-overlay-noarch.tar.xz && \ + rm -f /tmp/s6-overlay-noarch.tar.xz && \ + wget -O /tmp/s6-overlay-x86_64.tar.xz https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-x86_64.tar.xz && \ + tar -C / -Jxf /tmp/s6-overlay-x86_64.tar.xz && \ + rm -f /tmp/s6-overlay-x86_64.tar.xz && \ + wget -O /tmp/caddy.tar.gz https://github.com/caddyserver/caddy/releases/download/v${CADDY_VERSION}/caddy_${CADDY_VERSION}_linux_amd64.tar.gz && \ + tar -xzvf /tmp/caddy.tar.gz -C ${BASE_PATH}/caddy && \ + wget -O /tmp/overtls.zip https://github.com/shadowsocksr-live/overtls/releases/latest/download/overtls-x86_64-unknown-linux-musl.zip && \ + unzip /tmp/overtls.zip -d ${BASE_PATH}/overtls -x "config.json" && \ + rm -rf /var/cache/apk/* /tmp/* + + + +EXPOSE $HTTPS_PORT/tcp \ + $HTTPS_PORT/udp + + +VOLUME ["/web"] +HEALTHCHECK --interval=10s --timeout=5s CMD /healthcheck.sh + +ENTRYPOINT ["/init"] \ No newline at end of file diff --git a/docker_overtls_caddy/README.md b/docker_overtls_caddy/README.md new file mode 100644 index 0000000..f81b58f --- /dev/null +++ b/docker_overtls_caddy/README.md @@ -0,0 +1,7 @@ +# overtls_caddy +docker run -itd --restart always --name overtls -p 443:443 -e DOMAIN_NAME=域名 -e TUNNEL_PATH=/admin/,/log/ -v /web:/web chengxudong2020/overtls_caddy:latest + +# 參數說​​明 +-v /web 可選建議設定web靜態檔案所在目錄其中必須為包含index.php index.html index.htm index.nginx-debian.html 任何一個為預設首頁請自己從網上下載之後放入目錄重啟容器或者新建容器提前放好,映射之後的容器的目錄必須是/web +-e TUNNEL_PATH 可選 預設為 /secret-tunnel-path/ 請務必自行修改成複雜字串, 否則造成迅速被 GFW 封鎖之後果自負 +-e DOMAIN_NAME 必須配置否則無法啟動 域名,需要配置解析 \ No newline at end of file diff --git a/docker_overtls_caddy/rootfs/etc/caddy/Caddyfile b/docker_overtls_caddy/rootfs/etc/caddy/Caddyfile new file mode 100644 index 0000000..e69de29 diff --git a/docker_overtls_caddy/rootfs/etc/s6-overlay/s6-rc.d/caddy/dependencies b/docker_overtls_caddy/rootfs/etc/s6-overlay/s6-rc.d/caddy/dependencies new file mode 100644 index 0000000..e1021d2 --- /dev/null +++ b/docker_overtls_caddy/rootfs/etc/s6-overlay/s6-rc.d/caddy/dependencies @@ -0,0 +1,2 @@ +overtls +init \ No newline at end of file diff --git a/docker_overtls_caddy/rootfs/etc/s6-overlay/s6-rc.d/caddy/notification-fd b/docker_overtls_caddy/rootfs/etc/s6-overlay/s6-rc.d/caddy/notification-fd new file mode 100644 index 0000000..e440e5c --- /dev/null +++ b/docker_overtls_caddy/rootfs/etc/s6-overlay/s6-rc.d/caddy/notification-fd @@ -0,0 +1 @@ +3 \ No newline at end of file diff --git a/docker_overtls_caddy/rootfs/etc/s6-overlay/s6-rc.d/caddy/run b/docker_overtls_caddy/rootfs/etc/s6-overlay/s6-rc.d/caddy/run new file mode 100644 index 0000000..cd2e1d3 --- /dev/null +++ b/docker_overtls_caddy/rootfs/etc/s6-overlay/s6-rc.d/caddy/run @@ -0,0 +1,5 @@ +#!/command/with-contenv sh +CADDY_PATH="${BASE_PATH}/caddy" +exec \ + /command/s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost ${OVERTLS_PORT}" \ + "${CADDY_PATH}/caddy" run --config /etc/caddy/Caddyfile \ No newline at end of file diff --git a/docker_overtls_caddy/rootfs/etc/s6-overlay/s6-rc.d/caddy/type b/docker_overtls_caddy/rootfs/etc/s6-overlay/s6-rc.d/caddy/type new file mode 100644 index 0000000..1780f9f --- /dev/null +++ b/docker_overtls_caddy/rootfs/etc/s6-overlay/s6-rc.d/caddy/type @@ -0,0 +1 @@ +longrun \ No newline at end of file diff --git a/docker_overtls_caddy/rootfs/etc/s6-overlay/s6-rc.d/init/type b/docker_overtls_caddy/rootfs/etc/s6-overlay/s6-rc.d/init/type new file mode 100644 index 0000000..3d92b15 --- /dev/null +++ b/docker_overtls_caddy/rootfs/etc/s6-overlay/s6-rc.d/init/type @@ -0,0 +1 @@ +oneshot \ No newline at end of file diff --git a/docker_overtls_caddy/rootfs/etc/s6-overlay/s6-rc.d/init/up b/docker_overtls_caddy/rootfs/etc/s6-overlay/s6-rc.d/init/up new file mode 100644 index 0000000..ac4631c --- /dev/null +++ b/docker_overtls_caddy/rootfs/etc/s6-overlay/s6-rc.d/init/up @@ -0,0 +1 @@ +/etc/s6-overlay/s6-rc.d/init/up.real \ No newline at end of file diff --git a/docker_overtls_caddy/rootfs/etc/s6-overlay/s6-rc.d/init/up.real b/docker_overtls_caddy/rootfs/etc/s6-overlay/s6-rc.d/init/up.real new file mode 100644 index 0000000..80e6ccd --- /dev/null +++ b/docker_overtls_caddy/rootfs/etc/s6-overlay/s6-rc.d/init/up.real @@ -0,0 +1,84 @@ +#!/command/with-contenv sh +function initCaddyfile() { + rm -rf /etc/caddy/Caddyfile + cat > /etc/caddy/Caddyfile <> /etc/caddy/Caddyfile <> /etc/caddy/Caddyfile < ${BASE_PATH}/overtls/config.json < + + +Error + + + +

An error occurred.

+

Sorry, the page you are looking for is currently unavailable.
+Please try again later.

+

If you are the system administrator of this resource then you should check +the error log for details.

+

Faithfully yours, caddy.

+ + \ No newline at end of file diff --git a/docker_overtls_caddy/rootfs/web/index.html b/docker_overtls_caddy/rootfs/web/index.html new file mode 100644 index 0000000..0034663 --- /dev/null +++ b/docker_overtls_caddy/rootfs/web/index.html @@ -0,0 +1,23 @@ + + + +Welcome to caddy! + + + +

Welcome to caddy!

+

If you see this page, the nginx web server is successfully installed and +working. Further configuration is required.

+ +

For online documentation and support please refer to +caddy.com.
+Commercial support is available at +caddy.com.

+ +

Thank you for using caddy.

+ +