diff --git a/.github/workflows/build-alpine.yaml b/.github/workflows/.build-alpine.yaml similarity index 100% rename from .github/workflows/build-alpine.yaml rename to .github/workflows/.build-alpine.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index 5855781..177f6a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # 更新日志 +24w12c +--- +- PRE-RELEASE: 此版本是v1.4.1的预发布版本,请勿在生产环境中使用 +- CHANGE: 优化代码结构,提升性能 +- CHANGE: 尝试在DEV版本引入Alpine Linux作为基础镜像,减少镜像体积 + 24w12b --- - PRE-RELEASE: 此版本是v1.4.1的预发布版本,请勿在生产环境中使用 diff --git a/docker/dockerfile/dev/Dockerfile b/docker/dockerfile/dev/Dockerfile index 04d7a63..997bea1 100644 --- a/docker/dockerfile/dev/Dockerfile +++ b/docker/dockerfile/dev/Dockerfile @@ -1,4 +1,4 @@ -FROM wjqserver/caddy:daily +FROM wjqserver/caddy:daily-alpine ARG USER=WJQSERVER-STUDIO ARG REPO=ghproxy @@ -11,11 +11,11 @@ RUN wget -O /data/www/index.html https://raw.githubusercontent.com/${USER}/${REP RUN wget -O /data/www/favicon.ico https://raw.githubusercontent.com/${USER}/${REPO}/main/pages/favicon.ico RUN wget -O /data/caddy/Caddyfile https://raw.githubusercontent.com/${USER}/${REPO}/main/caddyfile/release/Caddyfile RUN VERSION=$(curl -s https://raw.githubusercontent.com/${USER}/${REPO}/main/DEV-VERSION) && \ - wget -O /data/${APPLICATION}/${APPLICATION} https://github.com/${USER}/${REPO}/releases/download/$VERSION/${APPLICATION} + wget -O /data/${APPLICATION}/${APPLICATION} https://github.com/${USER}/${REPO}/releases/download/$VERSION/ghproxy RUN wget -O /data/${APPLICATION}/config.yaml https://raw.githubusercontent.com/${USER}/${REPO}/main/config/config.yaml RUN wget -O /data/${APPLICATION}/blacklist.json https://raw.githubusercontent.com/${USER}/${REPO}/main/config/blacklist.json RUN wget -O /data/${APPLICATION}/whitelist.json https://raw.githubusercontent.com/${USER}/${REPO}/main/config/whitelist.json -RUN wget -O /usr/local/bin/init.sh https://raw.githubusercontent.com/${USER}/${REPO}/main/init.sh +RUN wget -O /usr/local/bin/init.sh https://raw.githubusercontent.com/${USER}/${REPO}/main/docker/dockerfile/alpine/init.sh RUN chmod +x /data/${APPLICATION}/${APPLICATION} RUN chmod +x /usr/local/bin/init.sh diff --git a/docker/dockerfile/alpine/Dockerfile b/docker/dockerfile/dev/Dockerfile.bak similarity index 88% rename from docker/dockerfile/alpine/Dockerfile rename to docker/dockerfile/dev/Dockerfile.bak index 17f4266..04d7a63 100644 --- a/docker/dockerfile/alpine/Dockerfile +++ b/docker/dockerfile/dev/Dockerfile.bak @@ -1,4 +1,4 @@ -FROM wjqserver/caddy:daily-alpine +FROM wjqserver/caddy:daily ARG USER=WJQSERVER-STUDIO ARG REPO=ghproxy @@ -11,11 +11,11 @@ RUN wget -O /data/www/index.html https://raw.githubusercontent.com/${USER}/${REP RUN wget -O /data/www/favicon.ico https://raw.githubusercontent.com/${USER}/${REPO}/main/pages/favicon.ico RUN wget -O /data/caddy/Caddyfile https://raw.githubusercontent.com/${USER}/${REPO}/main/caddyfile/release/Caddyfile RUN VERSION=$(curl -s https://raw.githubusercontent.com/${USER}/${REPO}/main/DEV-VERSION) && \ - wget -O /data/${APPLICATION}/${APPLICATION} https://github.com/${USER}/${REPO}/releases/download/$VERSION/ghproxy-alpine + wget -O /data/${APPLICATION}/${APPLICATION} https://github.com/${USER}/${REPO}/releases/download/$VERSION/${APPLICATION} RUN wget -O /data/${APPLICATION}/config.yaml https://raw.githubusercontent.com/${USER}/${REPO}/main/config/config.yaml RUN wget -O /data/${APPLICATION}/blacklist.json https://raw.githubusercontent.com/${USER}/${REPO}/main/config/blacklist.json RUN wget -O /data/${APPLICATION}/whitelist.json https://raw.githubusercontent.com/${USER}/${REPO}/main/config/whitelist.json -RUN wget -O /usr/local/bin/init.sh https://raw.githubusercontent.com/${USER}/${REPO}/main/docker/dockerfile/alpine/init.sh +RUN wget -O /usr/local/bin/init.sh https://raw.githubusercontent.com/${USER}/${REPO}/main/init.sh RUN chmod +x /data/${APPLICATION}/${APPLICATION} RUN chmod +x /usr/local/bin/init.sh diff --git a/docker/dockerfile/alpine/init.sh b/docker/dockerfile/dev/init.sh similarity index 100% rename from docker/dockerfile/alpine/init.sh rename to docker/dockerfile/dev/init.sh diff --git a/docker/dockerfile/release/init.sh b/docker/dockerfile/release/init.sh new file mode 100644 index 0000000..86db1e1 --- /dev/null +++ b/docker/dockerfile/release/init.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +APPLICATON=ghproxy + +if [ ! -f /data/caddy/config/Caddyfile ]; then + cp /data/caddy/Caddyfile /data/caddy/config/Caddyfile +fi + +if [ ! -f /data/${APPLICATON}/config/blacklist.json ]; then + cp /data/${APPLICATON}/blacklist.json /data/${APPLICATON}/config/blacklist.json +fi + +if [ ! -f /data/${APPLICATON}/config/whitelist.json ]; then + cp /data/${APPLICATON}/whitelist.json /data/${APPLICATON}/config/whitelist.json +fi + +if [ ! -f /data/${APPLICATON}/config/config.yaml ]; then + cp /data/${APPLICATON}/config.yaml /data/${APPLICATON}/config/config.yaml +fi + +/data/caddy/caddy run --config /data/caddy/config/Caddyfile > /data/${APPLICATON}/log/caddy.log 2>&1 & + +/data/${APPLICATON}/${APPLICATON} > /data/ghproxy/log/run.log 2>&1 & + +while [[ true ]]; do + sleep 1 +done +