chore: support docker. fix #30

This commit is contained in:
mzz2017 2023-03-04 13:16:26 +08:00
parent 4706f58d22
commit fd43971eab
5 changed files with 32 additions and 2 deletions

18
Dockerfile Normal file
View File

@ -0,0 +1,18 @@
FROM golang:1.20-bullseye AS builder
RUN apt-get update && apt-get install -y llvm clang git make
WORKDIR /build/
ADD go.mod go.sum ./
RUN go mod download
ADD . .
RUN git submodule update --init
RUN make OUTPUT=dae GOFLAGS="-buildvcs=false" CC=clang CGO_ENABLED=0
FROM alpine
RUN mkdir -p /usr/local/share/dae/
RUN mkdir -p /etc/dae/
RUN wget -O /usr/local/share/dae/geoip.dat https://github.com/v2ray/geoip/releases/latest/download/geoip.dat
RUN wget -O /usr/local/share/dae/geosite.dat https://github.com/v2ray/domain-list-community/releases/latest/download/dlc.dat
COPY --from=builder /build/dae /usr/local/bin
COPY --from=builder /build/install/empty.dae /etc/dae/config.dae
RUN chmod 0600 /etc/dae/config.dae
CMD ["dae", "run", "-c", "/etc/dae/config.dae"]

View File

@ -205,7 +205,7 @@ func newControlPlane(log *logrus.Logger, bpf interface{}, conf *config.Config) (
} }
if len(conf.Global.LanInterface) == 0 && len(conf.Global.WanInterface) == 0 { if len(conf.Global.LanInterface) == 0 && len(conf.Global.WanInterface) == 0 {
log.Warnln("No binding interface.") log.Warnln("No interface to bind.")
} }
c, err = control.NewControlPlane( c, err = control.NewControlPlane(

View File

@ -143,7 +143,7 @@ func NewControlPlane(
return nil, fmt.Errorf("load eBPF objects: %w", err) return nil, fmt.Errorf("load eBPF objects: %w", err)
} }
} }
log.Infof("eBPF programs and maps loaded")
// outboundId2Name can be modified later. // outboundId2Name can be modified later.
outboundId2Name := make(map[uint8]string) outboundId2Name := make(map[uint8]string)
core := newControlPlaneCore( core := newControlPlaneCore(

11
docker-compose.yml Normal file
View File

@ -0,0 +1,11 @@
version: "3"
services:
dae:
privileged: true
network_mode: host
pid: host
build:
context: .
volumes:
- /sys:/sys
- /etc/dae:/etc/dae

1
install/empty.dae Normal file
View File

@ -0,0 +1 @@
global {} routing {}