From 6ea9d4753fb0eb6d1cb9e0e80f0cefea99d01979 Mon Sep 17 00:00:00 2001 From: Antonio Gurgel Date: Sat, 12 Aug 2023 22:23:00 -0700 Subject: [PATCH] Dockerize --- Dockerfile | 24 ++++++++++++++++++++++++ docker_config.toml | 18 ++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 Dockerfile create mode 100644 docker_config.toml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f074342 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM golang:1.20 as build +WORKDIR /go/src/app + +COPY go.* . +RUN go mod download + +COPY . . + +RUN go vet -v ./... +RUN go test -v ./... +RUN \ + CGO_ENABLED=0 \ + VERSION=`git tag --sort=-version:refname | head -n 1` \ + go build -trimpath \ + -ldflags "-s -w -X main.version=$VERSION" \ + cmd/HellPot/*.go + + +FROM gcr.io/distroless/static-debian11 + +COPY --from=build /go/src/app/HellPot /app +COPY --from=build /go/src/app/docker_config.toml /config +EXPOSE 8080 +ENTRYPOINT ["/app", "-c", "/config"] diff --git a/docker_config.toml b/docker_config.toml new file mode 100644 index 0000000..725af3b --- /dev/null +++ b/docker_config.toml @@ -0,0 +1,18 @@ +[deception] + server_name = "nginx" + +[http] + bind_addr = "0.0.0.0" + bind_port = "8080" + real_ip_header = 'X-Real-IP' + uagent_string_blacklist = ["Cloudflare-Traffic-Manager", "curl"] + + [http.router] + catchall = true # /robots.txt assumed to be served elsewhence + +[logger] + debug = false + trace = false + directory = "/logs/" + nocolor = true + use_date_filename = true