Skip to content

Commit 67c8d9b

Browse files
committed
2 parents 0f1c0c1 + 8f2f3ce commit 67c8d9b

File tree

3 files changed

+5
-42
lines changed

3 files changed

+5
-42
lines changed

.github/workflows/docker.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
cache-to: type=registry,ref=${{ steps.meta.outputs.name }}:buildcache,mode=max
7575
tags: ${{ steps.meta.outputs.tags }}
7676
labels: ${{ steps.meta.outputs.labels }}
77-
platforms: linux/amd64
77+
platforms: linux/amd64,linux/arm64
7878
#
7979
username: ${{ secrets.DOCKERHUB_USERNAME }}
8080
password: ${{ secrets.DOCKERHUB_TOKEN }}

Dockerfile

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ COPY . .
1313

1414
RUN CGO_ENABLED=0 \
1515
GOOS=linux \
16-
GOARCH=amd64 \
1716
go build \
1817
-trimpath \
1918
-ldflags '-w -s -buildid=' \
@@ -37,7 +36,7 @@ ENV VERSION=${VERSION}
3736

3837
RUN zmicro package install ngrok
3938

40-
RUN zmicro package install cpolar
39+
# RUN zmicro package install cpolar
4140

4241
COPY ./entrypoint.sh /
4342

entrypoint.sh

+3-39
Original file line numberDiff line numberDiff line change
@@ -76,45 +76,9 @@ runtunnel() {
7676
log::info "[$(timestamp)] ngrok url: $(color::green $url)"
7777

7878
export SITE_URL=$url
79-
elif [ "$TUNNEL_TYPE" = "cpolar" ]; then
80-
if [ -n "$tunnel_subdomain" ] && [ -z "$tunnel_auth_token" ]; then
81-
log::error "[$(timestamp)] tunnel_auth_token is required when use tunnel_subdomain"
82-
return 1
83-
fi
84-
85-
if [ -n "$tunnel_auth_token" ]; then
86-
zmicro cpolar authtoken $tunnel_auth_token >>/dev/null
87-
fi
88-
89-
if [ -n "$tunnel_subdomain" ]; then
90-
zmicro cpolar http --subdomain "$tunnel_subdomain" ${PORT} --log $tunnel_log >>$tunnel_log 2>&1 &
91-
else
92-
zmicro cpolar http ${PORT} --log $tunnel_log >>$tunnel_log 2>&1 &
93-
fi
94-
95-
log::info "[$(timestamp)] starting cpolar ..."
96-
# sleep 3
97-
98-
local cpolar_url=""
99-
while [ -z "$cpolar_url" ]; do
100-
sleep 1
101-
102-
log::info "[$(timestamp)] checking whether cpolar connected ..."
103-
cpolar_url=$(cat $tunnel_log | grep "established" | grep "https" | awk -F 'at ' '{print $2}' | awk -F '"' '{print $1}')
104-
if [ -n "$cpolar_url" ]; then
105-
break
106-
fi
107-
108-
if [ "$DEBUG" = "true" ]; then
109-
log::info "[$(timestamp)] show cpolar connection info start ..."
110-
cat $tunnel_log
111-
log::info "[$(timestamp)] show cpolar connection info end ..."
112-
fi
113-
done
114-
115-
log::info "[$(timestamp)] cpolar url: $(color::green $cpolar_url)"
116-
117-
export SITE_URL=$cpolar_url
79+
else
80+
log::error "[$(timestamp)] unsupport TUNNEL_TYPE: $TUNNEL_TYPE"
81+
return 1
11882
fi
11983
}
12084

0 commit comments

Comments
 (0)