File tree Expand file tree Collapse file tree 4 files changed +61
-4
lines changed
Expand file tree Collapse file tree 4 files changed +61
-4
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,6 @@ security/cmd/node_agent/na/pkey
4040vendor
4141# Contains the built artifacts
4242out /
43- etc /
4443var /
4544# Go compiled tests
4645* .test
Original file line number Diff line number Diff line change 1515# specific language governing permissions and limitations
1616# under the License.
1717
18- From golang:1.24-alpine
18+
19+ # syntax=docker/dockerfile:1
20+
21+ # Build stage
22+ FROM golang:1.24-alpine AS builder
23+
24+ WORKDIR /app
25+
26+ # 安装 git 以支持 go mod 下载私有依赖(如有需要)
27+ RUN apk add --no-cache git
28+
29+ # 复制 go.mod 和 go.sum 并下载依赖
30+ COPY go.mod go.sum ./
31+ RUN go mod download
32+
33+ # 复制源代码
34+ COPY . .
35+
36+ # 构建二进制文件
37+ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o collector ./cmd/main.go
38+
39+ # Production stage
40+ FROM alpine:3.19
41+
42+ WORKDIR /app
43+
44+ # 拷贝构建产物
45+ COPY --from=builder /app/collector /app/collector
46+
47+ # 如有配置文件等需要一并拷贝
48+ # COPY --from=builder /app/etc /app/etc
49+
50+ # 暴露端口(如有需要)
51+ # EXPOSE 1158
52+
53+ ENTRYPOINT ["./collector" ]
Original file line number Diff line number Diff line change 1- go mod tidy
2-
31# HertzBeat Collector Go
42
53[ ![ License] ( https://img.shields.io/badge/license-Apache%202-blue )] ( LICENSE )
Original file line number Diff line number Diff line change 1+ # Licensed to the Apache Software Foundation (ASF) under one
2+ # or more contributor license agreements. See the NOTICE file
3+ # distributed with this work for additional information
4+ # regarding copyright ownership. The ASF licenses this file
5+ # to you under the Apache License, Version 2.0 (the
6+ # "License"); you may not use this file except in compliance
7+ # with the License. You may obtain a copy of the License at
8+ #
9+ # http://www.apache.org/licenses/LICENSE-2.0
10+ #
11+ # Unless required by applicable law or agreed to in writing,
12+ # software distributed under the License is distributed on an
13+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+ # KIND, either express or implied. See the License for the
15+ # specific language governing permissions and limitations
16+ # under the License.
17+
18+ collector :
19+ info :
20+ name : hertzbeat-collector-go
21+ ip : 127.0.0.1
22+ port : 8080
23+
24+ log :
25+ level : debug
You can’t perform that action at this time.
0 commit comments