Add trap to gracefully cleanup, add screen session
This commit is contained in:
parent
df3c6166ac
commit
ed6fc1af16
@ -17,7 +17,7 @@ RUN apk add curl openjdk8-jre &&\
|
||||
|
||||
# The second stage is the actual container
|
||||
FROM openjdk:8
|
||||
RUN apt-get update && apt-get install rsync -y
|
||||
RUN apt-get update && apt-get install rsync screen -y
|
||||
WORKDIR /minecraft
|
||||
COPY --from=build /minecraft .
|
||||
CMD [ "bash", "start-server.sh" ]
|
||||
|
@ -1,4 +1,4 @@
|
||||
#! /bin/sh
|
||||
#! /bin/bash
|
||||
#
|
||||
# start-server.sh
|
||||
# Copyright (C) 2021 Vintage Salt <rehashedsalt@cock.li>
|
||||
@ -33,5 +33,10 @@ java -version
|
||||
echo "Invoking java with args: $args"
|
||||
|
||||
# Start 'er up
|
||||
java $args
|
||||
cleanup() {
|
||||
screen -p 0 -S minecraft -X stuff save-all^M
|
||||
screen -p 0 -S minecraft -X stuff stop^M
|
||||
}
|
||||
trap cleanup EXIT
|
||||
screen -DmS minecraft java $args
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user