diff --git a/services/task/.gitignore b/services/task/.gitignore new file mode 100644 index 0000000..6d3dca9 --- /dev/null +++ b/services/task/.gitignore @@ -0,0 +1,2 @@ +run.toml +etc/task.yaml \ No newline at end of file diff --git a/services/task/Dockerfile b/services/task/Dockerfile new file mode 100644 index 0000000..a01be90 --- /dev/null +++ b/services/task/Dockerfile @@ -0,0 +1,37 @@ +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/ ./rpc +COPY services/task/ ./services/task/ + +WORKDIR /src/services/task + +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 . + +CMD ["./main", "-f", "etc/task.yaml"] diff --git a/services/task/etc/task.yaml b/services/task/etc/task.yaml deleted file mode 100644 index 7b8b251..0000000 --- a/services/task/etc/task.yaml +++ /dev/null @@ -1,7 +0,0 @@ -Nacos: - Hosts: - - host.docker.internal:8848 - NamespaceId: test - Group: LONE_SERVICES - RegisterIP: task - ConfigID: develop-task \ No newline at end of file