generated from kedaya_haitao/template
add 添加dockerfile
This commit is contained in:
parent
01725c688a
commit
d957e165d8
20
Dockerfile
Normal file
20
Dockerfile
Normal file
@ -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"]
|
@ -7,7 +7,7 @@ import (
|
|||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
var configFilePath = "config.yaml"
|
var configFilePath = "./config/config.yaml"
|
||||||
|
|
||||||
type Options struct {
|
type Options struct {
|
||||||
//Domain string `json:"domain" yaml:"domain"`
|
//Domain string `json:"domain" yaml:"domain"`
|
||||||
|
@ -2,7 +2,7 @@ port: 12580 # default 12580
|
|||||||
|
|
||||||
# source list file
|
# source list file
|
||||||
source-files:
|
source-files:
|
||||||
- /mnt/g/git.timerzz.com/proxy-detector/config/source.yaml
|
- ./config/source.yaml
|
||||||
# use web file
|
# use web file
|
||||||
# - https://example.com/config/source.yaml
|
# - https://example.com/config/source.yaml
|
||||||
|
|
||||||
|
2
main.go
2
main.go
@ -37,7 +37,7 @@ func main() {
|
|||||||
configFilePath = os.Getenv("CONFIG_FILE")
|
configFilePath = os.Getenv("CONFIG_FILE")
|
||||||
}
|
}
|
||||||
if configFilePath == "" {
|
if configFilePath == "" {
|
||||||
configFilePath = "config.yaml"
|
configFilePath = "./config/config.yaml"
|
||||||
}
|
}
|
||||||
config.LoadConfig(configFilePath)
|
config.LoadConfig(configFilePath)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user