-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
49 lines (41 loc) · 1.24 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Build stage
FROM golang:1.18.3-alpine3.16 as go-builder
ARG GOPROXY=goproxy.cn
ENV GOPROXY=https://${GOPROXY},direct
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk add --no-cache make bash git tzdata
WORKDIR /data
COPY go.mod go.sum ./
RUN go mod download -x
COPY . .
RUN ls -rlt ./ && make build
# 运行阶段
# 需要go环境
FROM golang:1.18.3-alpine3.16
LABEL maintainer="[email protected]"
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
USER root
ARG APP=goprobe
ENV APP=${APP}
ENV WORKDIR=/data
ENV GOPROXY=https://goproxy.cn,direct
COPY ./scripts/flamegraph.pl /bin/flamegraph.pl
# install graphivz,perl and set timeZone to Asia/Shanghai
RUN apk add --no-cache graphviz
RUN apk add perl
RUN chmod a+x /bin/flamegraph.pl
RUN apk add --no-cache tzdata bash
COPY --from=go-builder /data/bin/${APP} ${WORKDIR}/bin/
COPY --from=go-builder /data/config ${WORKDIR}/config
ENV TZ="Asia/Shanghai"
WORKDIR ${WORKDIR}
# http
EXPOSE 9001
# 预留
EXPOSE 9002
# govern
EXPOSE 9003
#ENV EGO_DEBUG=true
#ENTRYPOINT ["sh","-c","sleep 3000s"," && ","/data/goprobe","--config=config/local.toml"]
#ENTRYPOINT ["/data/goprobe","--config=config/local.toml"]
CMD ["sh", "-c", "./bin/goprobe"]