diff --git a/Dockerfile b/Dockerfile index 6924681..cb4d81f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,15 @@ FROM java:8 ENV MIN_MEM=512M -ENV MAX_MEM=512M +ENV MAX_MEM=8G ENV STOP="stop" -COPY ./main /main -COPY ./cmd /usr/local/bin/cmd +COPY ./bin/main /main +COPY ./bin/cmd /usr/local/bin/cmd COPY ./entry.sh /entry.sh EXPOSE 25565 VOLUME [ "/server" ] -ENTRYPOINT [ "/main" ] \ No newline at end of file +ENTRYPOINT [ "/main" ] diff --git a/bin/cmd b/bin/cmd index c5d1cf0..1c630d2 100755 Binary files a/bin/cmd and b/bin/cmd differ diff --git a/bin/main b/bin/main index 7d81985..bec5d7d 100755 Binary files a/bin/main and b/bin/main differ diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 index e69de29..5ee2624 --- a/build.sh +++ b/build.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +go build -o bin/main src/main.go +go build -o bin/cmd src/cmd.go +sudo docker build -t minecraft . diff --git a/cmd b/cmd new file mode 100644 index 0000000..838db6b Binary files /dev/null and b/cmd differ diff --git a/docker-compose.yml b/docker-compose.yml index 60e64ee..b18a4cd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,14 +2,28 @@ version: '3.7' services: - proxy: + minecraft: image: minecraft + container_name: minecraft restart: unless-stopped environment: - MAX_MEM: 2G + MAX_MEM: 1G ports: - 25565:25565 volumes: - /home/jimmy/misc/paper/:/server stdin_open: true + tty: true + + minecraft2: + image: minecraft + container_name: minecraft2 + restart: unless-stopped + environment: + MAX_MEM: 1G + ports: + - 25566:25565 + volumes: + - /home/jimmy/misc/paper2/:/server + stdin_open: true tty: true \ No newline at end of file diff --git a/main b/main new file mode 100644 index 0000000..7d81985 Binary files /dev/null and b/main differ diff --git a/src/main.go b/src/main.go index 54a250b..1ca5d1d 100644 --- a/src/main.go +++ b/src/main.go @@ -16,7 +16,7 @@ import ( func main() { sigs := make(chan os.Signal, 1) - signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM) + signal.Notify(sigs, syscall.SIGTERM) var minram, maxram, args, stop string for _, e := range os.Environ() { @@ -57,7 +57,7 @@ func main() { go func() { sig := <-sigs - if sig == syscall.SIGTERM || sig == syscall.SIGINT { + if sig == syscall.SIGTERM { fmt.Println("Stopping server") tty.WriteString(stop + "\n\r") }