Skip to content

Commit

Permalink
fix: Update entrypoint.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxuan6 committed Jul 23, 2024
1 parent 0eadbc6 commit 5169426
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 15 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.github/
logs/*.log
service/logs/*.log
service/config.cfg
.gitignore
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
image-name: service-status
image-tags: ${{ steps.tags.outputs.VERSION }}
additional-image-tags: "${{ steps.tags.outputs.VERSION }}"
custom-args: --platform=linux/arm64,linux/amd64
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ FROM caddy:2.4.5-alpine
WORKDIR /etc/caddy

COPY --link src ./src
COPY --link logs ./logs
COPY --link Caddyfile config.cfg favicon.ico index.html entrypoint.sh ./
COPY --from=build-dev /go/src/app/status ./status

RUN apk update && \
apk add --no-cache bash curl tzdata && \
chmod +x /etc/caddy/status && \
chmod +x ./entrypoint.sh
chmod +x ./entrypoint.sh && \
chmod 777 /etc/caddy/logs

ENV VERBOSE=false
ENV TZ=Asia/Shanghai
Expand Down
2 changes: 2 additions & 0 deletions config.cfg
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
baidu=https://www.baidu.com
juejin=https://www.juejin.cn
juejincom=https://www.juejin.com
4 changes: 2 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash

if [ "$VERBOSE" = "true" ]; then
nohup /etc/caddy/status > /etc/caddy/status.log 2>&1 &
nohup /etc/caddy/status > /tmp/status.log 2>&1 &

sleep 3
cat /etc/caddy/status.log
cat /tmp/status.log
else
nohup /etc/caddy/status > /dev/null 2>&1 &
fi
Expand Down
Empty file added logs/.gitea
Empty file.
8 changes: 0 additions & 8 deletions service/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,6 @@ func run() {
os.Exit(1)
}

if _, err := os.Stat(dir); os.IsNotExist(err) {
err := os.Mkdir(dir, os.ModePerm)
if err != nil {
fmt.Printf("创建文件夹失败: %v\n", err)
os.Exit(1)
}
}

content, _ := os.ReadFile(configFile)
f := bufio.NewReader(strings.NewReader(string(content)))
for {
Expand Down
6 changes: 4 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,10 @@ function splitRowsByDate(rows) {
}

let result = 0;
if (resultStr.trim() == "success") {
result = 1;
if (resultStr !== undefined && resultStr !== null) {
if (resultStr.trim() == "success") {
result = 1;
}
}
sum += result;
count++;
Expand Down

0 comments on commit 5169426

Please sign in to comment.