Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerize #97

Merged
merged 1 commit into from
Aug 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Dockerfile
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Went ahead and set this up for you by adding a configuration directive to [logger] called docker_logging

I also implemented something else you might want to use for this before we merge. All configuration directives should now abide/be overridden by matching environment variables, example:

# [logger]
# docker_logging = true
HELLPOT_LOGGER_DOCKER_LOGGING=1 # "true" is also acceptable

# [http]
# bind_addr = "0.0.0.0"
HELLPOT_HTTP_BIND_ADDR="0.0.0.0"

Original file line number Diff line number Diff line change
@@ -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"]
18 changes: 18 additions & 0 deletions docker_config.toml
Original file line number Diff line number Diff line change
@@ -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