Dockerfile
This commit is contained in:
parent
9e812e050a
commit
13f4082849
6 changed files with 44 additions and 7 deletions
13
Dockerfile
Normal file
13
Dockerfile
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
FROM ubuntu:20.04
|
||||
|
||||
RUN apt update && apt install -y arp-scan && apt clean \
|
||||
&& mkdir /data
|
||||
|
||||
COPY templates /app/templates
|
||||
COPY watchyourlan /app/
|
||||
|
||||
EXPOSE 8840
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ENTRYPOINT ["./watchyourlan"]
|
||||
32
Makefile
32
Makefile
|
|
@ -1,8 +1,32 @@
|
|||
DUSER=aceberg
|
||||
DNAME=watchyourlan
|
||||
DPORT=8840
|
||||
VERSION=0.4
|
||||
|
||||
mod:
|
||||
rm go.mod
|
||||
go mod init watchyourlan
|
||||
go mod init $(DNAME)
|
||||
go mod tidy
|
||||
|
||||
run:
|
||||
go run .
|
||||
build:
|
||||
go build .
|
||||
sudo go run .
|
||||
|
||||
go-build:
|
||||
go build .
|
||||
|
||||
docker-build:
|
||||
docker build -t $(DUSER)/$(DNAME):latest -t $(DUSER)/$(DNAME):$(VERSION) .
|
||||
|
||||
docker-run:
|
||||
docker rm wyl || true
|
||||
docker run --name wyl \
|
||||
-e "IFACE=virbr-bw" \
|
||||
--network="host" \
|
||||
-v ~/.dockerdata/wyl:/data \
|
||||
$(DUSER)/$(DNAME):$(VERSION)
|
||||
|
||||
clean:
|
||||
rm $(DNAME) || true
|
||||
docker rmi -f $(DUSER)/$(DNAME):latest $(DUSER)/$(DNAME):$(VERSION)
|
||||
|
||||
dev: go-build docker-build docker-run
|
||||
|
|
@ -9,7 +9,7 @@ import (
|
|||
)
|
||||
|
||||
func scan_iface(iface string) (string) {
|
||||
cmd, err := exec.Command("sudo", "arp-scan", "-l", "-N", "-x", "-I", iface).Output()
|
||||
cmd, err := exec.Command("arp-scan", "-glNx", "-I", iface).Output()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import (
|
|||
|
||||
func get_config(path string) (config Conf) {
|
||||
viper.SetDefault("IFACE", "eth0")
|
||||
viper.SetDefault("DBPATH", "data/db.sqlite")
|
||||
viper.SetDefault("DBPATH", "/data/db.sqlite")
|
||||
viper.SetDefault("GUIIP", "localhost")
|
||||
viper.SetDefault("GUIPORT", "8840")
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
<th>Ip</th>
|
||||
<th>Mac</th>
|
||||
<th>Hardware</th>
|
||||
<th>Date</th>
|
||||
<th>Last seen</th>
|
||||
<th>Known</th>
|
||||
</tr>
|
||||
{{ range . }}
|
||||
|
|
|
|||
BIN
watchyourlan
Executable file
BIN
watchyourlan
Executable file
Binary file not shown.
Loading…
Reference in a new issue