diff --git a/.gitea/workflows/cd-test.yml b/.gitea/workflows/cd-test.yml index 9e2614c..835ad97 100644 --- a/.gitea/workflows/cd-test.yml +++ b/.gitea/workflows/cd-test.yml @@ -29,6 +29,13 @@ jobs: - name: Sync Host Repo working-directory: /data/www/lone-services run: | + mkdir -p ~/.ssh + chmod 700 ~/.ssh + touch ~/.ssh/known_hosts + chmod 600 ~/.ssh/known_hosts + if ! grep -q 'git.ailuowan.com' ~/.ssh/known_hosts; then + ssh-keyscan -t ed25519 git.ailuowan.com >> ~/.ssh/known_hosts + fi git fetch origin develop git pull origin develop diff --git a/services/chore/Dockerfile b/services/chore/Dockerfile new file mode 100644 index 0000000..8614291 --- /dev/null +++ b/services/chore/Dockerfile @@ -0,0 +1,39 @@ +FROM golang:1.26.5-alpine AS builder + +WORKDIR /src + +ENV GOPROXY=https://goproxy.cn,direct \ + CGO_ENABLED=0 \ + GOOS=linux \ + GOARCH=amd64 + +COPY pkg ./pkg +COPY go.mod go.sum ./ + +RUN --mount=type=cache,target=/go/pkg/mod \ + go mod download + +COPY rpc/chore/ ./rpc/chore/ +COPY services/chore/ ./services/chore/ + +WORKDIR /src/services/chore + +RUN --mount=type=cache,target=/go/pkg/mod \ + --mount=type=cache,target=/root/.cache/go-build \ + go build -ldflags="-s -w" -o /out/main ./ + +FROM alpine:3.22 + +WORKDIR /app + +ENV TZ=Asia/Shanghai + +RUN apk add --no-cache tzdata \ + && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ + && echo "Asia/Shanghai" > /etc/timezone + +COPY --from=builder /out/main . + +EXPOSE 10500 + +CMD ["./main", "-f", "etc/chore.yaml"]