diff options
-rw-r--r-- | .gitignore | 3 | ||||
-rwxr-xr-x | bin/acore-docker-build | 8 | ||||
-rw-r--r-- | bin/acore-docker-remove-build-cache | 10 | ||||
-rw-r--r-- | docker-compose.yml | 6 | ||||
-rw-r--r-- | docker/README.md | 4 | ||||
-rw-r--r-- | docker/authserver/Dockerfile | 2 | ||||
-rw-r--r-- | docker/authserver/README.md | 1 | ||||
-rw-r--r-- | docker/authserver/bin/.gitkeep | 0 | ||||
-rw-r--r-- | docker/build/Dockerfile | 14 | ||||
-rw-r--r-- | docker/build/README.md | 32 | ||||
-rw-r--r-- | docker/build/cache/.gitkeep | 0 | ||||
-rw-r--r-- | docker/worldserver/Dockerfile | 2 | ||||
-rw-r--r-- | docker/worldserver/README.md | 3 | ||||
-rw-r--r-- | docker/worldserver/bin/.gitkeep | 0 |
14 files changed, 64 insertions, 21 deletions
diff --git a/.gitignore b/.gitignore index 36b12a76dd..c5a733d422 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,9 @@ modules/* !modules/*.sh build*/ var/* +docker/build/cache +docker/authserver/bin +docker/worldserver/bin docker/authserver/etc/authserver.conf docker/worldserver/etc/worldserver.conf docker/authserver/logs/ diff --git a/bin/acore-docker-build b/bin/acore-docker-build index a13c92ebfc..6a32b02839 100755 --- a/bin/acore-docker-build +++ b/bin/acore-docker-build @@ -1,3 +1,9 @@ #!/usr/bin/env bash -docker build -t azerothcore/build -f docker/build/Dockerfile . +docker build -t acbuild -f docker/build/Dockerfile . + +docker run \ + -v /$(pwd)/docker/build/cache:/azerothcore/build \ + -v /$(pwd)/docker/worldserver/bin:/binworldserver \ + -v /$(pwd)/docker/authserver/bin:/binauthserver \ + acbuild diff --git a/bin/acore-docker-remove-build-cache b/bin/acore-docker-remove-build-cache new file mode 100644 index 0000000000..817a18da39 --- /dev/null +++ b/bin/acore-docker-remove-build-cache @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +sudo rm -rf ./docker/build/cache/CMakeFiles +sudo rm -rf ./docker/build/cache/deps +sudo rm -rf ./docker/build/cache/src +sudo rm ./docker/build/cache/*.cmake +sudo rm ./docker/build/cache/*.txt +sudo rm ./docker/build/cache/*.h +sudo rm ./docker/build/cache/*.cpp +sudo rm ./docker/build/cache/Makefile diff --git a/docker-compose.yml b/docker-compose.yml index 49b53fe068..48cb8e167b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -27,6 +27,9 @@ services: - ${WORLD_EXTERNAL_PORT:-8085}:8085 volumes: - type: bind + source: ./docker/worldserver/bin + target: /azeroth-server/bin + - type: bind source: ${WORLDSERVER_ETC:-./docker/worldserver/etc} target: /azeroth-server/etc - type: bind @@ -49,6 +52,9 @@ services: - ${AUTH_EXTERNAL_PORT:-3724}:3724 volumes: - type: bind + source: ./docker/authserver/bin + target: /azeroth-server/bin + - type: bind source: ${AUTHSERVER_ETC:-./docker/authserver/etc} target: /azeroth-server/etc - type: bind diff --git a/docker/README.md b/docker/README.md index ffcd665684..c68315b30a 100644 --- a/docker/README.md +++ b/docker/README.md @@ -24,11 +24,11 @@ You have to follow these steps (**respecting the order**): 2) Launch one instance of the [AzerothCore Dockerized Database](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/database) -3) Create an image of the [AzerothCore Dockerized Build](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/build) +3) Build AzerothCore using [AzerothCore Dockerized Build](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/build) 4) Launch one instance of the [AzerothCore Dockerized Authserver](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/authserver) -5) Launch one instance of the [AzerothCore Dockerized Worldserver](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/worldserver) +5) Launch one instance of the [AzerothCore Dockerized Worldserver](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/worldserver) ### Memory usage diff --git a/docker/authserver/Dockerfile b/docker/authserver/Dockerfile index cef902b59c..c329a66cd0 100644 --- a/docker/authserver/Dockerfile +++ b/docker/authserver/Dockerfile @@ -2,6 +2,4 @@ FROM ubuntu:bionic RUN apt update && apt install -y libmysqlclient-dev libssl-dev libace-6.* libace-dev; -COPY --from=azerothcore/build:latest /azeroth-server/bin /azeroth-server/bin - CMD ["/azeroth-server/bin/authserver"] diff --git a/docker/authserver/README.md b/docker/authserver/README.md index 03091db060..0361e579f9 100644 --- a/docker/authserver/README.md +++ b/docker/authserver/README.md @@ -28,6 +28,7 @@ docker build -t azerothcore/authserver -f docker/authserver/Dockerfile docker/au ``` docker run --name ac-authserver \ + --mount type=bind,source="$(pwd)"/docker/authserver/bin/,target=/azeroth-server/bin \ --mount type=bind,source="$(pwd)"/docker/authserver/etc/,target=/azeroth-server/etc \ --mount type=bind,source="$(pwd)"/docker/authserver/logs/,target=/azeroth-server/logs \ -p 127.0.0.1:3724:3724 \ diff --git a/docker/authserver/bin/.gitkeep b/docker/authserver/bin/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/docker/authserver/bin/.gitkeep diff --git a/docker/build/Dockerfile b/docker/build/Dockerfile index d282011ed6..2ef8d35962 100644 --- a/docker/build/Dockerfile +++ b/docker/build/Dockerfile @@ -8,10 +8,10 @@ ADD conf/config.cmake.dist /azerothcore/conf/config.cmake.dist ADD src /azerothcore/src ADD CMakeLists.txt /azerothcore/CMakeLists.txt -RUN cd azerothcore; \ - mkdir build; \ - cd build; \ - cmake ../ -DCMAKE_INSTALL_PREFIX=/azeroth-server -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DTOOLS=0 -DSCRIPTS=1; \ - MTHREADS=`grep -c ^processor /proc/cpuinfo`; MTHREADS=$(($MTHREADS + 2)); \ - make -j $MTHREADS; \ - make install -j $MTHREADS; +ENTRYPOINT cd azerothcore/build && \ + cmake ../ -DCMAKE_INSTALL_PREFIX=/azeroth-server -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DTOOLS=0 -DSCRIPTS=1 && \ + MTHREADS=`grep -c ^processor /proc/cpuinfo`; MTHREADS=$(($MTHREADS + 2)) && \ + make -j $MTHREADS && \ + make install -j $MTHREADS && \ + cp /azeroth-server/bin/worldserver /binworldserver && \ + cp /azeroth-server/bin/authserver /binauthserver diff --git a/docker/build/README.md b/docker/build/README.md index cf5b113ab6..a47db99e9f 100644 --- a/docker/build/README.md +++ b/docker/build/README.md @@ -1,15 +1,35 @@ # AzerothCore Dockerized Build -The AzerothCore Build Dockerfile is not meant to create containers, it is a stage that both the [authserver](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/authserver) and the [worldserver](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/worldserver) docker images will use. +The AzerothCore Build Dockerfile will create a container that will run the AC build. -Note: every time you update your AzerothCore sources, you **must** build again this image and the authserver & worldserver images to get the new version on your docker containers. +When this container runs, it will compile AC and generate: -*For more information about Docker multi-stage builds, refer to the [docker multi-stage builds doc](https://docs.docker.com/develop/develop-images/multistage-build/).* +- the build cache in the `docker/build/cache` directory +- the `worldserver` executable file in `docker/worldserver/bin` +- the `authserver` executable file in `docker/authserver/bin` -# Usage +The executable files will be used by the [authserver](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/authserver) and the [worldserver](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/worldserver) docker containers. -To build the container image you have to be in the **main** folder of your local AzerothCore sources directory. +Note: every time you update your AzerothCore sources, you **must** run again the build container and restart your `worldserver` and `authserver` containers. + +## Usage + +To build the container image you have to be in the **main** folder of your local AzerothCore sources directory and run: + +``` +docker build -t acbuild -f docker/build/Dockerfile . +``` + +Then you can launch the container to rebuild AC using: ``` -docker build -t azerothcore/build -f docker/build/Dockerfile . +docker run \ + -v /$(pwd)/docker/build/cache:/azerothcore/build \ + -v /$(pwd)/docker/worldserver/bin:/binworldserver \ + -v /$(pwd)/docker/authserver/bin:/binauthserver \ + acbuild ``` + +### Clearing the cache + +To clear the build cache, delete all files contained under the `docker/build/cache` directory. diff --git a/docker/build/cache/.gitkeep b/docker/build/cache/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/docker/build/cache/.gitkeep diff --git a/docker/worldserver/Dockerfile b/docker/worldserver/Dockerfile index 70a0aeaa01..345b605955 100644 --- a/docker/worldserver/Dockerfile +++ b/docker/worldserver/Dockerfile @@ -2,6 +2,4 @@ FROM ubuntu:bionic RUN apt update && apt install -y libmysqlclient-dev libssl-dev libace-6.* libace-dev libreadline-dev; -COPY --from=azerothcore/build:latest /azeroth-server/bin /azeroth-server/bin - CMD ["/azeroth-server/bin/worldserver"] diff --git a/docker/worldserver/README.md b/docker/worldserver/README.md index a0e889541e..3e8f577c52 100644 --- a/docker/worldserver/README.md +++ b/docker/worldserver/README.md @@ -8,7 +8,7 @@ If you just want to install the whole AzerothCore quickly using Docker Compose, - You need to have [Docker](https://docs.docker.com/install/) installed in your system. You can install it on any operating system. -- You need to first build the [AzerothCore Build Image](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/build). +- You need to first build AzerothCore using the [AzerothCore Dockerized Build](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/build). - If you haven't created a docker network yet, create it by simply using `docker network create ac-network`. @@ -31,6 +31,7 @@ Replace `/path/to/your/data` with the path of where your data folder is. ``` docker run --name ac-worldserver \ --mount type=bind,source=/path/to/your/data,target=/azeroth-server/data \ + --mount type=bind,source="$(pwd)"/docker/worldserver/bin/,target=/azeroth-server/bin \ --mount type=bind,source="$(pwd)"/docker/worldserver/etc/,target=/azeroth-server/etc \ --mount type=bind,source="$(pwd)"/docker/worldserver/logs/,target=/azeroth-server/logs \ -p 127.0.0.1:8085:8085 \ diff --git a/docker/worldserver/bin/.gitkeep b/docker/worldserver/bin/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/docker/worldserver/bin/.gitkeep |