add 添加dockerfile

This commit is contained in:
timerzz 2024-12-10 10:44:32 +08:00
parent 01725c688a
commit d957e165d8
4 changed files with 23 additions and 3 deletions

20
Dockerfile Normal file
View 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"]

View File

@ -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"`

View File

@ -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

View File

@ -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)