Initial commit
This commit is contained in:
parent
7164b61dd0
commit
bc851eaeb7
|
@ -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" ]
|
||||
ENTRYPOINT [ "/main" ]
|
||||
|
|
|
@ -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 .
|
|
@ -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
|
|
@ -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")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue