minimal image seems ok
This commit is contained in:
parent
9f32a0adc7
commit
aefc414c63
@ -1,12 +1,13 @@
|
|||||||
FROM golang as builder
|
FROM golang:1.16.6-alpine3.14 as builder
|
||||||
WORKDIR /app/dtm
|
WORKDIR /app/dtm
|
||||||
RUN go env -w GO111MODULE=on
|
RUN go env -w GO111MODULE=on
|
||||||
RUN go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/,direct
|
RUN go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/,direct
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" app/main.go
|
RUN CGO_ENABLED=0 GOOS=linux go build app/main.go
|
||||||
|
|
||||||
FROM scratch as runner
|
FROM alpine:3.14 as runner
|
||||||
COPY --from=builder /app/dtm/main /app/dtm/main
|
COPY --from=builder /app/dtm/main /app/dtm/
|
||||||
ENV IS_DOCKER=1
|
ENV IS_DOCKER=1
|
||||||
|
WORKDIR /app/dtm
|
||||||
CMD ["/app/dtm/main", "dtmsvr"]
|
CMD ["/app/dtm/main", "dtmsvr"]
|
||||||
@ -140,7 +140,7 @@ func init() {
|
|||||||
"password": os.Getenv("DB_PASSWORD"),
|
"password": os.Getenv("DB_PASSWORD"),
|
||||||
}
|
}
|
||||||
cont := []byte{}
|
cont := []byte{}
|
||||||
for d := MustGetwd(); d != ""; d = filepath.Dir(d) {
|
for d := MustGetwd(); d != "" && d != "/"; d = filepath.Dir(d) {
|
||||||
cont1, err := ioutil.ReadFile(d + "/conf.yml")
|
cont1, err := ioutil.ReadFile(d + "/conf.yml")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cont1, err = ioutil.ReadFile(d + "/conf.sample.yml")
|
cont1, err = ioutil.ReadFile(d + "/conf.sample.yml")
|
||||||
@ -156,5 +156,6 @@ func init() {
|
|||||||
dtmcli.FatalIfError(err)
|
dtmcli.FatalIfError(err)
|
||||||
}
|
}
|
||||||
dtmcli.LogIfFatalf(DtmConfig.DB["driver"] == "" || DtmConfig.DB["user"] == "",
|
dtmcli.LogIfFatalf(DtmConfig.DB["driver"] == "" || DtmConfig.DB["user"] == "",
|
||||||
"dtm config error: %v. check you env, and conf.yml/conf.sample.yml found in current and parent path: %s", DtmConfig, MustGetwd())
|
"dtm config error: %v. check you env, and conf.yml/conf.sample.yml in current and parent path: %s", DtmConfig, MustGetwd())
|
||||||
|
dtmcli.Logf("after fatalIf")
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user