mirror of
https://github.com/nezhahq/nezha.git
synced 2025-02-02 01:28:13 -05:00
28 lines
842 B
Docker
28 lines
842 B
Docker
FROM golang:alpine AS binarybuilder
|
|
RUN apk --no-cache --no-progress add \
|
|
gcc git musl-dev
|
|
WORKDIR /agent
|
|
COPY . .
|
|
RUN cd cmd/agent && go build -o app -ldflags="-s -w -X github.com/p14yground/nezha/service/dao.Version=$(git rev-parse HEAD)"
|
|
|
|
FROM alpine:latest
|
|
RUN apk --no-cache --no-progress add \
|
|
ca-certificates \
|
|
tzdata
|
|
WORKDIR /agent
|
|
COPY --from=binarybuilder /agent/cmd/agent/app ./app
|
|
|
|
ENV HOST_PROC /agent/host/proc
|
|
ENV HOST_SYS /agent/host/sys
|
|
ENV HOST_ETC /agent/host/etc
|
|
ENV HOST_VAR /agent/host/var
|
|
ENV HOST_RUN /agent/host/run
|
|
ENV HOST_DEV /agent/host/dev
|
|
|
|
ENV DEBUG false #服务器使用IP时请设置为true
|
|
|
|
ENV [ID, SECRET, SERVER]
|
|
|
|
VOLUME ["/agent/host/proc", "/agent/host/sys", "/agent/host/etc", "/agent/host/var", "/agent/host/run", "/agent/host/dev"]
|
|
CMD /agent/app -s $SERVER -i $ID -p $SECRET -d $DEBUG
|