diff --git a/Dockerfile b/Dockerfile index b0b7c44..5004416 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.6 +FROM golang:1.21.6 as build WORKDIR /app @@ -13,9 +13,13 @@ COPY util ./util COPY views ./views EXPOSE 5566 -RUN go build . +RUN CGO_ENABLED=0 go build . + +FROM alpine as main +COPY --from=build /app /app ARG PASSWORD ENV PASSWORD $PASSWORD +WORKDIR /app ENTRYPOINT ["/app/ezcat"] diff --git a/README.md b/README.md index e5f2b67..23a07b7 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,16 @@ docker run --rm --network host \ or you can download the latest binary from the [releases tab](https://github.com/ngn13/ezcat/releases), extract it with `tar` and then copy it to somewhere in your `PATH`. +By default ezcat will try to detect your interface IP address (giving priority to tunnel interfaces). +If you want set this IP address to something else by default, you can use the `SHELLIP` environment variable: +``` +docker run --rm --network host \ + -e PASSWORD=securepassword \ + -e SHELLIP=10.10.10.15 \ + ghcr.io/ngn13/ezcat + +``` + --- ### ⚒️ Build diff --git a/util/util.go b/util/util.go index 4aab304..488ff35 100644 --- a/util/util.go +++ b/util/util.go @@ -4,6 +4,7 @@ import ( "encoding/base64" "math/rand" "net" + "os" "strings" "github.com/gofiber/fiber/v2" @@ -78,6 +79,11 @@ func GetAddr(addrs []net.Addr) string { } func GetIP() string { + enip := os.Getenv("SHELLIP") + if enip != "" { + return enip + } + ip := "127.0.0.1" foundtun := false ifs, err := net.Interfaces()