Browse Source
Merge pull request #1 from thehuntedpie/master
Nice work man =))
master
ViViV_
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with
108 additions and
33 deletions
.dockerignore
.gitignore
Dockerfile
README.md
build.sh
console.sh
deploy.sh
docker-compose.build.yml
docker-compose.yml
docker-entrypoint.sh
dockerfile
entrypoint.sh
push.sh
@ -0,0 +1,8 @@
# ignore swp files
*.sw[g-p]
# ignore .env file
.env
# ignore jar files
*.jar
@ -0,0 +1,26 @@
FROM openjdk:8-jdk-alpine
LABEL author = "ViViV_" maintainer = "sysadmin@whiteshield.ch"
LABEL author = "thehuntedpie" maintainer = "thehuntedpie@gmail.com"
EXPOSE 6567/TCP
EXPOSE 6567/UDP
RUN apk add --update --no-cache curl ca-certificates openssl git \
tar bash
RUN apk add --update --no-cache sqlite
RUN adduser -D -h /var/lib/mindustry mindustry
COPY Mindustry-server-4.0-alpha-56.jar /usr/local/share/mindustry/server.jar
USER root
WORKDIR /var/lib/mindustry
VOLUME /var/lib/mindustry/.mindustry
COPY ./docker-entrypoint.sh /
ENTRYPOINT [ "/docker-entrypoint.sh" ]
CMD [ "host" ]
@ -6,11 +6,25 @@ Just download docker-compose.yml
Host Server : `docker-compose up -d`
Attach terminal `docker attach ${CONTAINER_NAME}`
## Docker Commands
Host Server : `docker run --name mindustry -ti -p 6567:6567/tcp -p 6567:6567/udp viviv/mindustry`
Host Server : `docker run --name mindustry -i -p 6567:6567/tcp -p 6567:6567/udp viviv/mindustry`
# Manage Mindustry Console
## Attach Console
Attach terminal with `docker attach --sig-proxy=false mindustry_server`
ATTENTION! The terminal will not have any indicators that you have connected to the console. Just type help to get started.
### Detach Console
To detach the console type Ctrl-C . The server should remain running.
### Console Commands
The script 'console.sh' lets you run commands in the console from outside the container with output.
usage: `./console.sh status`
WARNING! This script seems to perform well but is not very well tested. Use with caution!
### Enjoy !!
@ -0,0 +1,2 @@
#!/bin/bash
docker-compose -f docker-compose.build.yml build mindustry
@ -0,0 +1,18 @@
#!/bin/bash
COMMAND = ${ @ } ;
CONTAINER = mindustry_server;
DATE = ` date -Iseconds` ;
echo " $COMMAND " | docker attach $CONTAINER &
PID = $$
# reasonably speaking, logs dont happen til action is done
while [ " $LOGS " = = "" ] ; do
LOGS = $( docker logs --since " $DATE " $CONTAINER )
done
# sleep just in case stuff is still going on
sleep 1
echo " $LOGS "
{ kill $PID } 2>/dev/null
@ -0,0 +1,7 @@
#!/bin/bash
# COMPOSE_PROJECT_NAME should be a unique string for this deployment. Otherwise, if you run multiple deployments, docker-compose down may take down a previous deployment with the same COMPOSE_PROJECT_NAME or parent folder name
COMPOSE_PROJECT_NAME = mindustry-server
docker-compose down
docker-compose up -d
@ -0,0 +1,7 @@
version : '3.1'
services:
mindustry:
build : .
image : thehuntedpie/mindustry:4.0-alpha-56
@ -1,13 +1,19 @@
version : '3.1'
version : "3.1"
services:
mindustry:
image : viviv/mindustry
image : "thehuntedpie/mindustry:4.0-alpha-56"
container_name : "mindustry_server"
hostname : "mindustry-server"
ports:
- '6567:6567/tcp'
- '6567:6567/udp'
tty : true
- "6567:6567/tcp" #host-port:internal-port
- "6567:6567/udp"
environment:
- "JAVA_OPTS=-Xms1G -Xmx2G" #set memory limits
command:
- "load 1,host" # load save 1 and then host. see help for options
tty : false
stdin_open : true
restart : always
volumes:
- "/data/mindustry:/root/.mindustry"
- "/data/mindustry:/var/lib/mindustry /.mindustry"
@ -0,0 +1,8 @@
#!/bin/bash -x
Server_Args = $1
# change ownership of home directory
chown mindustry:mindustry -R ~mindustry
# run server as non-elevated user
su mindustry bash -c 'java -jar /usr/local/share/mindustry/server.jar ' " ${ Server_Args } "
@ -1,21 +0,0 @@
FROM openjdk:8-jdk-alpine
LABEL author="ViViV_" maintainer="sysadmin@whiteshield.ch"
EXPOSE 6567/TCP
EXPOSE 6567/UDP
RUN apk add --update --no-cache curl ca-certificates openssl git tar bash sqlite \
&& adduser -D -h /home/container container
ADD . /home/container/
USER root
ENV USER=root HOME=/home/container
WORKDIR /home/container
VOLUME /data/mindustry
COPY ./entrypoint.sh /entrypoint.sh
CMD ["/bin/bash", "/entrypoint.sh"]
@ -1,3 +0,0 @@
#!/bin/bash
su container
java -jar -Xms1G -Xmx2G Mindustry-server-4.0-alpha-56.jar host
@ -0,0 +1,2 @@
#!/bin/bash
docker-compose -f docker-compose.build.yml push mindustry