Initial commit

This commit is contained in:
Jimmy Allen 2020-10-13 21:10:19 +13:00
parent 7164b61dd0
commit bc851eaeb7
8 changed files with 27 additions and 8 deletions

View File

@ -1,11 +1,11 @@
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

BIN
bin/cmd

Binary file not shown.

BIN
bin/main

Binary file not shown.

5
build.sh Normal file → Executable file
View File

@ -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 .

BIN
cmd Normal file

Binary file not shown.

View File

@ -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

BIN
main Normal file

Binary file not shown.

View File

@ -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")
}