diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..50b8495 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM golang:alpine as builder +ARG HTTP_PROXY=http://192.168.31.55:10809 +ARG HTTPS_PROXY=http://192.168.31.55:10809 +ARG GO111MODULE=on +ARG GOPROXY=https://goproxy.cn +WORKDIR /proxy-detector-src +COPY . /proxy-detector-src +RUN go mod download && \ + go mod tidy && \ + go build -o ./bin/proxy-detector && \ + mv ./bin/proxy-detector /proxy-detector + +FROM alpine:latest +ARG HTTP_PROXY=http://192.168.31.55:10809 +ARG HTTPS_PROXY=http://192.168.31.55:10809 +RUN apk add --no-cache ca-certificates tzdata +WORKDIR /proxy-detector-src +COPY ./config /proxy-detector-src/config +COPY --from=builder /proxy-detector /proxy-detector-src/ +ENTRYPOINT ["/proxy-detector-src/proxy-detector", "-d"] diff --git a/config/config.go b/config/config.go index 79904b6..824dc76 100644 --- a/config/config.go +++ b/config/config.go @@ -7,7 +7,7 @@ import ( "gopkg.in/yaml.v3" ) -var configFilePath = "config.yaml" +var configFilePath = "./config/config.yaml" type Options struct { //Domain string `json:"domain" yaml:"domain"` diff --git a/config/config.yaml b/config/config.yaml index c6a74cd..254cfe9 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -2,7 +2,7 @@ port: 12580 # default 12580 # source list file source-files: - - /mnt/g/git.timerzz.com/proxy-detector/config/source.yaml + - ./config/source.yaml # use web file # - https://example.com/config/source.yaml diff --git a/main.go b/main.go index f6691a3..2b4f61f 100644 --- a/main.go +++ b/main.go @@ -37,7 +37,7 @@ func main() { configFilePath = os.Getenv("CONFIG_FILE") } if configFilePath == "" { - configFilePath = "config.yaml" + configFilePath = "./config/config.yaml" } config.LoadConfig(configFilePath)