Dockerize honeypot using multi-stage Dockerfile (#1)

* Add Dockerfile

* Add instructions for running as docker container
This commit is contained in:
Leo Verto 2021-12-13 17:46:59 +00:00 committed by GitHub
parent fb81cffa7e
commit a06f2538c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 1 deletions

6
.dockerignore Normal file
View File

@ -0,0 +1,6 @@
payloads/
.idea/
.dockerignore
.gitignore
Dockerfile
README.md

16
Dockerfile Normal file
View File

@ -0,0 +1,16 @@
# Build environment
FROM golang:1.17-alpine AS builder
COPY . $GOPATH/src/github.com/Adikso/minecraft-log4j-honeypot
WORKDIR $GOPATH/src/github.com/Adikso/minecraft-log4j-honeypot
RUN go install .
# Export binary only from builder environment
FROM alpine:latest AS runner
COPY --from=builder /go/bin/minecraft-log4j-honeypot /usr/local/bin/minecraft-log4j-honeypot
VOLUME payloads
EXPOSE 25565
ENTRYPOINT ["/usr/local/bin/minecraft-log4j-honeypot"]

View File

@ -7,10 +7,19 @@ This honeypots runs fake Minecraft server (1.7.2 - 1.16.5 without snapshots) wai
## Running
### Natively
```
git clone https://github.com/Adikso/minecraft-log4j-honeypot.git
cd minecraft-log4j-honeypot
go build .
./minecraft-log4j-honeypot
```
### Using docker
```
git clone https://github.com/Adikso/minecraft-log4j-honeypot.git
cd minecraft-log4j-honeypot
docker build -t minecraft-log4j-honeypot .
mkdir payloads
docker run --rm -it --mount type=bind,source="${PWD}/payloads",target=/payloads --user=`id -u` -p 25565:25565 minecraft-log4j-honeypot
```