Create a docker container image and runing it with docker-compose (#164)
* make the dockerfile working and docker-compose * add Readme * update docker-compose.yml * fix interaction with the mangosd server
This commit is contained in:
parent
a5b82444f7
commit
b6dda4df13
28
dockercontainer/DockerFile-mangosd
Normal file
28
dockercontainer/DockerFile-mangosd
Normal file
@ -0,0 +1,28 @@
|
||||
#Build image
|
||||
FROM ubuntu:18.04 as build-step
|
||||
|
||||
RUN apt-get -y update
|
||||
RUN apt-get -y install curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool build-essential
|
||||
|
||||
COPY . /mangoserver
|
||||
RUN mkdir /mangoserver/build
|
||||
WORKDIR /mangoserver/build
|
||||
|
||||
#Install mangos
|
||||
RUN cmake .. -DCMAKE_INSTALL_PREFIX=/mangos -DBUILD_MANGOSD=1 -DBUILD_REALMD=0 -DBUILD_TOOLS=0
|
||||
RUN make -j4
|
||||
RUN make install
|
||||
|
||||
#Runtime image
|
||||
FROM ubuntu:18.04 as runtime
|
||||
|
||||
RUN apt-get -y update && apt-get -y upgrade
|
||||
RUN apt-get -y install libmysqlclient20 openssl
|
||||
|
||||
COPY --from=build-step /mangos /mangos
|
||||
WORKDIR /mangos/bin
|
||||
RUN cp ../etc/mangosd.conf.dist ../etc/mangosd.conf
|
||||
RUN chmod +x mangosd
|
||||
|
||||
EXPOSE 8085
|
||||
ENTRYPOINT [ "./mangosd" ]
|
28
dockercontainer/DockerFile-realmd
Normal file
28
dockercontainer/DockerFile-realmd
Normal file
@ -0,0 +1,28 @@
|
||||
#Build image
|
||||
FROM ubuntu:18.04 as build-step
|
||||
|
||||
RUN apt-get -y update
|
||||
RUN apt-get -y install curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool build-essential
|
||||
|
||||
COPY . /mangoserver
|
||||
RUN mkdir /mangoserver/build
|
||||
WORKDIR /mangoserver/build
|
||||
|
||||
#Install mangos
|
||||
RUN cmake .. -DCMAKE_INSTALL_PREFIX=/mangos -DBUILD_MANGOSD=0 -DBUILD_REALMD=1 -DBUILD_TOOLS=0
|
||||
RUN make -j4
|
||||
RUN make install
|
||||
|
||||
#Runtime image
|
||||
FROM ubuntu:18.04 as runtime
|
||||
|
||||
RUN apt-get -y update && apt-get -y upgrade
|
||||
RUN apt-get -y install libmysqlclient20 openssl
|
||||
|
||||
COPY --from=build-step /mangos /mangos
|
||||
WORKDIR /mangos/bin
|
||||
RUN cp ../etc/realmd.conf.dist ../etc/realmd.conf
|
||||
RUN chmod +x realmd
|
||||
|
||||
EXPOSE 3724
|
||||
ENTRYPOINT [ "./realmd" ]
|
20
dockercontainer/Readme.txt
Normal file
20
dockercontainer/Readme.txt
Normal file
@ -0,0 +1,20 @@
|
||||
How to start:
|
||||
To start the docker container use the command "docker-compose up" inside the dockercontainer folder
|
||||
If you need to rebuild the images use "docker-compose build"
|
||||
|
||||
Now to setup the server make sure you have the correct configuration and the data folder in the correct location:
|
||||
The configuration should be place here "../../etc" from the dockercontainer folder
|
||||
The data folder should be place here "../../data" from the dockercontainer folder
|
||||
Note: those paths can be change inside the docker-compose.yml file
|
||||
|
||||
Configutation:
|
||||
Inside your "mangosd.conf" make sure the "DataDir" is set to "/mangos/data"
|
||||
Make sure all the mysql hostname is set to "mysqldb"
|
||||
The Mysql connection seting is set inside the docker-compose.yml file and can be change
|
||||
Here the default values:
|
||||
- MYSQL_USER=mangos
|
||||
- MYSQL_PASSWORD=mangos
|
||||
- MYSQL_ROOT_PASSWORD=mangos
|
||||
- MYSQL_ROOT_HOST=%
|
||||
|
||||
The database need to be run manualy in order to have it initialize
|
48
dockercontainer/docker-compose.yml
Normal file
48
dockercontainer/docker-compose.yml
Normal file
@ -0,0 +1,48 @@
|
||||
#To start the server from this docker-compose file you can run the command "docker-compose up"
|
||||
#Configure the location of the configuration file and the data folder
|
||||
#The connection to mysql should match the name of the service in this case "mysqldb"
|
||||
version: "2.4"
|
||||
services:
|
||||
mangosd:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: dockercontainer/Dockerfile-mangosd
|
||||
depends_on:
|
||||
- mysqldb
|
||||
restart: always
|
||||
ports:
|
||||
- "8085:8085"
|
||||
stdin_open: true
|
||||
tty: true
|
||||
volumes:
|
||||
# - ./local/path/to/etc:/mangos/etc
|
||||
# - ./local/path/to/data:/mangos/data
|
||||
- ../../etc:/mangos/etc
|
||||
- ../../data:/mangos/data
|
||||
|
||||
realmd:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: dockercontainer/Dockerfile-realmd
|
||||
depends_on:
|
||||
- mysqldb
|
||||
restart: always
|
||||
ports:
|
||||
- "3724:3724"
|
||||
volumes:
|
||||
# - ./local/path/to/etc:/mangos/etc
|
||||
- ../../etc:/mangos/etc
|
||||
|
||||
mysqldb:
|
||||
image: mysql:5.6
|
||||
restart: always
|
||||
environment:
|
||||
- MYSQL_USER=mangos
|
||||
- MYSQL_PASSWORD=mangos
|
||||
- MYSQL_ROOT_PASSWORD=mangos
|
||||
- MYSQL_ROOT_HOST=%
|
||||
ports:
|
||||
- "3306:3306"
|
||||
volumes:
|
||||
# - ./local/path/to/mysqldatabase:/var/lib/mysql
|
||||
- ../../dbdata:/var/lib/mysql
|
Loading…
x
Reference in New Issue
Block a user