Skip to content

Commit

Permalink
chore: support docker. fix #30
Browse files Browse the repository at this point in the history
  • Loading branch information
mzz2017 committed Mar 4, 2023
1 parent 4706f58 commit fd43971
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 2 deletions.
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
2 changes: 1 addition & 1 deletion cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
log.Warnln("No binding interface.")
log.Warnln("No interface to bind.")
}

c, err = control.NewControlPlane(
Expand Down
2 changes: 1 addition & 1 deletion control/control_plane.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func NewControlPlane(
return nil, fmt.Errorf("load eBPF objects: %w", err)
}
}

log.Infof("eBPF programs and maps loaded")
// outboundId2Name can be modified later.
outboundId2Name := make(map[uint8]string)
core := newControlPlaneCore(
Expand Down
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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 change: 1 addition & 0 deletions install/empty.dae
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
global {} routing {}

0 comments on commit fd43971

Please sign in to comment.