Initial commit
This commit is contained in:
parent
7164b61dd0
commit
bc851eaeb7
|
@ -1,15 +1,15 @@
|
||||||
FROM java:8
|
FROM java:8
|
||||||
|
|
||||||
ENV MIN_MEM=512M
|
ENV MIN_MEM=512M
|
||||||
ENV MAX_MEM=512M
|
ENV MAX_MEM=8G
|
||||||
ENV STOP="stop"
|
ENV STOP="stop"
|
||||||
|
|
||||||
COPY ./main /main
|
COPY ./bin/main /main
|
||||||
COPY ./cmd /usr/local/bin/cmd
|
COPY ./bin/cmd /usr/local/bin/cmd
|
||||||
COPY ./entry.sh /entry.sh
|
COPY ./entry.sh /entry.sh
|
||||||
|
|
||||||
EXPOSE 25565
|
EXPOSE 25565
|
||||||
|
|
||||||
VOLUME [ "/server" ]
|
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:
|
services:
|
||||||
proxy:
|
minecraft:
|
||||||
image: minecraft
|
image: minecraft
|
||||||
|
container_name: minecraft
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
MAX_MEM: 2G
|
MAX_MEM: 1G
|
||||||
ports:
|
ports:
|
||||||
- 25565:25565
|
- 25565:25565
|
||||||
volumes:
|
volumes:
|
||||||
- /home/jimmy/misc/paper/:/server
|
- /home/jimmy/misc/paper/:/server
|
||||||
stdin_open: true
|
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
|
tty: true
|
|
@ -16,7 +16,7 @@ import (
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
sigs := make(chan os.Signal, 1)
|
sigs := make(chan os.Signal, 1)
|
||||||
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
|
signal.Notify(sigs, syscall.SIGTERM)
|
||||||
|
|
||||||
var minram, maxram, args, stop string
|
var minram, maxram, args, stop string
|
||||||
for _, e := range os.Environ() {
|
for _, e := range os.Environ() {
|
||||||
|
@ -57,7 +57,7 @@ func main() {
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
sig := <-sigs
|
sig := <-sigs
|
||||||
if sig == syscall.SIGTERM || sig == syscall.SIGINT {
|
if sig == syscall.SIGTERM {
|
||||||
fmt.Println("Stopping server")
|
fmt.Println("Stopping server")
|
||||||
tty.WriteString(stop + "\n\r")
|
tty.WriteString(stop + "\n\r")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue