From dbf69fcc251a388cef7332eab5f3c4613a7fa690 Mon Sep 17 00:00:00 2001 From: zzw <1464003642@qq.com> Date: Mon, 14 Sep 2026 14:04:59 +0800 Subject: [PATCH] feat: pay Dockerfile --- services/payment/Dockerfile | 37 +++++++++++++++++++++++++++++ services/payment/run.toml | 46 +++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 services/payment/Dockerfile create mode 100644 services/payment/run.toml diff --git a/services/payment/Dockerfile b/services/payment/Dockerfile new file mode 100644 index 0000000..5458024 --- /dev/null +++ b/services/payment/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/payment/ ./services/payment/ + +WORKDIR /src/services/payment + +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/payment.yaml"] diff --git a/services/payment/run.toml b/services/payment/run.toml new file mode 100644 index 0000000..c606b12 --- /dev/null +++ b/services/payment/run.toml @@ -0,0 +1,46 @@ +[base] + login_out_time=43200 + login_refresh_out_time=83200 + name = "payment-service" + listenOn = "0.0.0.0:11200" + mode = "dev" +[log] + path = "logs" + serviceName = "payment-service" + mode = "file" + encoding = "plain" + level = "info" + keepDays = 7 + maxSize = 50 + maxBackups = 5 + compress = false +[mysql] + host = '39.106.171.204' + port = 33066 + user = 'root' + password = 'MOLXRZNOU4Y4' + database = 'dms-payment' + charset = 'utf8mb4' + prefix = '' + debug = true +[mysql_read] + host = '39.106.171.204' + port = 33066 + user = 'root' + password = 'MOLXRZNOU4Y4' + database = 'dms-payment' + charset = 'utf8mb4' + prefix = '' + +[redis] + host = '39.106.171.204' + password = 'lLMLcuPpzSj' + port = 6379 + db = 0 +[log-redis] + host = '39.106.171.204' + password = 'lLMLcuPpzSj' + port = 6379 + db = 3 +[encrypt] + data_key = "u2t9T3luZtoRfhBstkFN6TiIMW38BA8a" \ No newline at end of file