Skip to content

Commit

Permalink
Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
aceberg committed Aug 17, 2022
1 parent 9e812e0 commit 13f4082
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 7 deletions.
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 changes: 28 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion arpscan.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion getconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h2>Log</h2>
<th>Ip</th>
<th>Mac</th>
<th>Hardware</th>
<th>Date</th>
<th>Last seen</th>
<th>Known</th>
</tr>
{{ range . }}
Expand Down
Binary file added watchyourlan
Binary file not shown.

0 comments on commit 13f4082

Please sign in to comment.