summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMike Delago <32778141+michaeldelago@users.noreply.github.com>2023-10-15 08:47:09 -0700
committerGitHub <noreply@github.com>2023-10-15 17:47:09 +0200
commitc4dc20a814451a27aef8113e829809a2b6587e3b (patch)
treea7480e17d2fdaa24eb71433d5efcd546a43bc20e /apps
parentd1d46074a6d959d03c54de584db96e893cd0b5c4 (diff)
refactor(Docker): remove prod container distinction (#17419)
* refactor(Docker): remove prod containers * workflows: use buildx * properly set tags * comment in Dockerfile * set docker build context * minor CI changes * CI: docker build args shouldnt have quotes * CI: using matrix and caching is too much work * CI: I hate yaml * CI: It was a typo * CI: extra build removed * CI: appease the linter * fixup! CI: appease the linter * fixup! CI: appease the linter * apps: docker: remove extraneous files
Diffstat (limited to 'apps')
-rw-r--r--apps/docker/Dockerfile479
-rw-r--r--apps/docker/Dockerfile.dev-server83
-rw-r--r--apps/docker/README.md40
-rw-r--r--apps/docker/config-docker.sh8
-rw-r--r--apps/docker/docker-build-dev.sh14
-rwxr-xr-xapps/docker/docker-build-prod.sh5
-rw-r--r--apps/docker/docker-cmd.sh74
-rw-r--r--apps/docker/entrypoint.sh22
8 files changed, 382 insertions, 343 deletions
diff --git a/apps/docker/Dockerfile b/apps/docker/Dockerfile
index 358a7b2a9f..6164326072 100644
--- a/apps/docker/Dockerfile
+++ b/apps/docker/Dockerfile
@@ -1,344 +1,255 @@
-#syntax=docker/dockerfile:1.2
-
-#================================================================
-#
-# DEV: Stage used for the development environment
-# and the locally built services
-#
-#=================================================================
-
-FROM ubuntu:20.04 as base
-ARG USER_ID=1000
-ARG GROUP_ID=1000
-ARG DOCKER_USER=acore
-
-LABEL description="AC base image for dev containers"
-
-# List of timezones: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
-
-ENV DOCKER=1
-
-# Ensure ac-dev-server can properly pull versions
-ENV GIT_DISCOVERY_ACROSS_FILESYSTEM=1
-
-# set timezone environment variable
-ENV TZ=Etc/UTC
-
-# set noninteractive mode so tzdata doesn't ask to set timezone on install
-ENV DEBIAN_FRONTEND=noninteractive
-
-# Do not use acore dashboard to install
-# since it's not cacheable by docker
-RUN apt-get update && apt-get install -y gdb gdbserver git dos2unix lsb-core sudo curl unzip \
- make cmake clang libmysqlclient-dev \
- libboost-system1.7*-dev libboost-filesystem1.7*-dev libboost-program-options1.7*-dev libboost-iostreams1.7*-dev \
- build-essential libtool cmake-data openssl libgoogle-perftools-dev google-perftools \
- libssl-dev libmysql++-dev libreadline6-dev zlib1g-dev libbz2-dev mysql-client \
- libncurses5-dev ccache \
- && rm -rf /var/lib/apt/lists/*
-
-# Ensure git will work with the AzerothCore source directory
-RUN git config --global --add safe.directory /azerothcore
-
-# change timezone in container
-RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata
-
-# Create a non-root user
-RUN addgroup --gid "$GROUP_ID" "$DOCKER_USER" && \
- adduser --disabled-password --gecos '' --uid "$USER_ID" --gid "$GROUP_ID" "$DOCKER_USER" && \
- passwd -d "$DOCKER_USER" && \
- echo "$DOCKER_USER ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers
-
-# must be created to set the correct permissions on them
-RUN mkdir -p /azerothcore/env/dist/bin
-RUN mkdir -p /azerothcore/env/dist/data/Cameras
-RUN mkdir -p /azerothcore/env/dist/data/dbc
-RUN mkdir -p /azerothcore/env/dist/data/maps
-RUN mkdir -p /azerothcore/env/dist/data/mmaps
-RUN mkdir -p /azerothcore/env/dist/data/vmaps
-RUN mkdir -p /azerothcore/env/dist/logs
-RUN mkdir -p /azerothcore/env/dist/temp
-RUN mkdir -p /azerothcore/env/dist/etc
-RUN mkdir -p /azerothcore/var/build/obj
-
-# Correct permissions for non-root operations
-RUN chown -R $DOCKER_USER:$DOCKER_USER /home/acore
-RUN chown -R $DOCKER_USER:$DOCKER_USER /run
-RUN chown -R $DOCKER_USER:$DOCKER_USER /opt
-RUN chown -R $DOCKER_USER:$DOCKER_USER /azerothcore
-
-USER $DOCKER_USER
-
-# copy only necessary files for the acore dashboard
-COPY --chown=$DOCKER_USER:$DOCKER_USER apps /azerothcore/apps
-COPY --chown=$DOCKER_USER:$DOCKER_USER bin /azerothcore/bin
-COPY --chown=$DOCKER_USER:$DOCKER_USER conf /azerothcore/conf
-COPY --chown=$DOCKER_USER:$DOCKER_USER data /azerothcore/data
-COPY --chown=$DOCKER_USER:$DOCKER_USER deps /azerothcore/deps
-COPY --chown=$DOCKER_USER:$DOCKER_USER acore.json /azerothcore/acore.json
-COPY --chown=$DOCKER_USER:$DOCKER_USER acore.sh /azerothcore/acore.sh
-
-# Download deno and make sure the dashboard works
-RUN bash /azerothcore/acore.sh quit
+ARG UBUNTU_VERSION=22.04 # lts
+ARG TZ=Etc/UTC
+
+# This target lays out the general directory skeleton for AzerothCore,
+# This target isn't intended to be directly used
+FROM ubuntu:$UBUNTU_VERSION as skeleton
+
+ARG DOCKER=1
+ARG DEBIAN_FRONTEND=noninteractive
+
+ENV TZ=$TZ
+ENV AC_FORCE_CREATE_DB=1
+
+RUN mkdir -pv \
+ /azerothcore/bin \
+ /azerothcore/data \
+ /azerothcore/deps \
+ /azerothcore/env/dist/bin \
+ /azerothcore/env/dist/data/Cameras \
+ /azerothcore/env/dist/data/dbc \
+ /azerothcore/env/dist/data/maps \
+ /azerothcore/env/dist/data/mmaps \
+ /azerothcore/env/dist/data/vmaps \
+ /azerothcore/env/dist/logs \
+ /azerothcore/env/dist/temp \
+ /azerothcore/env/dist/etc \
+ /azerothcore/modules \
+ /azerothcore/src \
+ /azerothcore/build
+
+# Configure Timezone
+RUN apt-get update \
+ && apt-get install -y tzdata ca-certificates \
+ && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
+ && echo $TZ > /etc/timezone \
+ && dpkg-reconfigure --frontend noninteractive tzdata
WORKDIR /azerothcore
-#================================================================
-#
-# Dev: create dev server image
-#
-#=================================================================
-
-FROM base as dev
+# This target builds the docker image
+# This target can be useful to inspect the explicit outputs from the build,
+FROM skeleton as build
+
+ARG CTOOLS_BUILD="all"
+ARG CTYPE="RelWithDebInfo"
+ARG CCACHE_CPP2="true"
+ARG CSCRIPTPCH="OFF"
+ARG CSCRIPTS="static"
+ARG CMODULES="static"
+ARG CSCRIPTS_DEFAULT_LINKAGE="static"
+ARG CWITH_WARNINGS="ON"
+ARG CMAKE_EXTRA_OPTIONS=""
+ARG GIT_DISCOVERY_ACROSS_FILESYSTEM=1
+
+ARG CCACHE_DIR="/ccache"
+ARG CCACHE_MAXSIZE="1000MB"
+ARG CCACHE_SLOPPINESS="pch_defines,time_macros,include_file_mtime"
+ARG CCACHE_COMPRESS=""
+ARG CCACHE_COMPRESSLEVEL="9"
+ARG CCACHE_COMPILERCHECK="content"
+ARG CCACHE_LOGFILE=""
+
+RUN apt-get update \
+ && apt-get install -y --no-install-recommends \
+ build-essential ccache libtool cmake-data make cmake clang \
+ git lsb-base curl unzip default-mysql-client openssl \
+ default-libmysqlclient-dev libboost-all-dev libssl-dev libmysql++-dev \
+ libreadline-dev zlib1g-dev libbz2-dev libncurses5-dev \
+ && rm -rf /var/lib/apt/lists/*
+
+COPY CMakeLists.txt /azerothcore/CMakeLists.txt
+COPY conf /azerothcore/conf
+COPY deps /azerothcore/deps
+COPY src /azerothcore/src
+COPY modules /azerothcore/modules
-LABEL description="AC dev image for dev containers"
-
-USER $DOCKER_USER
-
-# copy everything so we can work directly within the container
-# using tools such as vscode dev-container
-# NOTE: this folder is different by the /azerothcore (which is binded instead)
-COPY --chown=$DOCKER_USER:$DOCKER_USER . /azerothcore
-
-#================================================================
-#
-# SERVICE BASE: prepare the OS for the production-ready services
-#
-#=================================================================
+ARG CACHEBUST=1
-FROM ubuntu:20.04 as servicebase
+WORKDIR /azerothcore/build
+
+RUN --mount=type=cache,target=/ccache,sharing=locked \
+ # This may seem silly (and it is), but AzerothCore wants the git repo at
+ # build time. The git repo is _huge_ and it's not something that really
+ # makes sense to mount into the container, but this way we can let the build
+ # have the information it needs without including the hundreds of megabytes
+ # of git repo into the container.
+ --mount=type=bind,target=/azerothcore/.git,source=.git \
+ git config --global --add safe.directory /azerothcore \
+ && cmake /azerothcore \
+ -DCMAKE_INSTALL_PREFIX="/azerothcore/env/dist" \
+ -DAPPS_BUILD="all" \
+ -DTOOLS_BUILD="$CTOOLS_BUILD" \
+ -DSCRIPTS="$CSCRIPTS" \
+ -DMODULES="$CMODULES" \
+ -DWITH_WARNINGS="$CWITH_WARNINGS" \
+ -DCMAKE_BUILD_TYPE="$CTYPE" \
+ -DCMAKE_CXX_COMPILER="clang++" \
+ -DCMAKE_C_COMPILER="clang" \
+ -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \
+ -DCMAKE_C_COMPILER_LAUNCHER="ccache" \
+ -DBoost_USE_STATIC_LIBS="ON" \
+ && cmake --build . --config "$CTYPE" -j $(($(nproc) + 1)) \
+ && cmake --install . --config "$CTYPE"
+
+#############################
+# Base runtime for services #
+#############################
+
+FROM skeleton as runtime
ARG USER_ID=1000
ARG GROUP_ID=1000
ARG DOCKER_USER=acore
-LABEL description="AC service image for server applications"
-
-# List of timezones: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
+ENV ACORE_COMPONENT=undefined
-# set timezone environment variable
-ENV TZ=Etc/UTC
+# Install base dependencies for azerothcore
+RUN apt-get update && \
+ apt-get install -y --no-install-recommends \
+ libmysqlclient21 libreadline8 \
+ gettext-base default-mysql-client && \
+ rm -rf /var/lib/apt/lists/*
-# set noninteractive mode so tzdata doesn't ask to set timezone on install
-ENV DEBIAN_FRONTEND=noninteractive
+COPY --from=build /azerothcore/env/dist/etc/ /azerothcore/env/ref/etc
-# Create a non-root user
-RUN addgroup --gid "$GROUP_ID" "$DOCKER_USER" && \
- adduser --disabled-password --gecos '' --uid "$USER_ID" --gid "$GROUP_ID" "$DOCKER_USER" && \
- passwd -d "$DOCKER_USER" && \
- echo "$DOCKER_USER ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers
-
-# install the required dependencies to run the server
-RUN apt-get update && apt-get install -y dos2unix gdb gdbserver google-perftools libgoogle-perftools-dev net-tools \
- libboost-system1.7*-dev libboost-filesystem1.7*-dev libboost-program-options1.7*-dev libboost-iostreams1.7*-dev \
- tzdata libmysqlclient-dev mysql-client curl unzip && rm -rf /var/lib/apt/lists/* ;
+VOLUME /azerothcore/env/dist/etc
-# change timezone in container
-RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata
+ENV PATH="/azerothcore/env/dist/bin:$PATH"
-# Correct permissions for non-root operations
-RUN chown -R $DOCKER_USER:$DOCKER_USER /home/acore
-RUN chown -R $DOCKER_USER:$DOCKER_USER /run
-RUN chown -R $DOCKER_USER:$DOCKER_USER /opt
+RUN groupadd --gid "$GROUP_ID" "$DOCKER_USER" && \
+ useradd -d /azerothcore --uid "$USER_ID" --gid "$GROUP_ID" "$DOCKER_USER" && \
+ passwd -d "$DOCKER_USER" && \
+ chown -R "$DOCKER_USER:$DOCKER_USER" /azerothcore
-COPY --chown=$DOCKER_USER:$DOCKER_USER --from=base /azerothcore /azerothcore
+COPY apps/docker/entrypoint.sh /entrypoint.sh
+RUN chmod -v +x /entrypoint.sh
USER $DOCKER_USER
-# must be created to avoid permissions errors
-RUN mkdir -p /azerothcore/env/dist/data/Cameras
-RUN mkdir -p /azerothcore/env/dist/data/dbc
-RUN mkdir -p /azerothcore/env/dist/data/maps
-RUN mkdir -p /azerothcore/env/dist/data/mmaps
-RUN mkdir -p /azerothcore/env/dist/data/vmaps
-RUN mkdir -p /azerothcore/env/dist/logs
-RUN mkdir -p /azerothcore/env/dist/etc
-RUN mkdir -p /azerothcore/env/dist/bin
+ENTRYPOINT ["/entrypoint.sh"]
-# Download deno and make sure the dashboard works
-RUN bash /azerothcore/acore.sh quit
+###############
+# Auth Server #
+###############
-WORKDIR /azerothcore/
+FROM runtime as authserver
+LABEL description "AzerothCore Auth Server"
-#================================================================
-#
-# AUTH & WORLD local: images used for local services
-# These images don't include binaries by default
-#
-#=================================================================
+ENV ACORE_COMPONENT=authserver
+# Don't run database migrations. We can leave that up to the db-import container
+ENV AC_UPDATES_ENABLE_DATABASES=0
+# This disables user prompts. The console is still active, however
+ENV AC_DISABLE_INTERACTIVE=1
+ENV AC_CLOSE_IDLE_CONNECTIONS=0
-FROM servicebase as authserver-local
+COPY --chown=$DOCKER_USER:$DOCKER_USER \
+ --from=build \
+ /azerothcore/env/dist/bin/authserver /azerothcore/env/dist/bin/authserver
-LABEL description="AC authserver image for local environment"
-CMD ./acore.sh run-authserver
+CMD ["authserver"]
-USER $DOCKER_USER
+################
+# World Server #
+################
-FROM servicebase as worldserver-local
+FROM runtime as worldserver
-LABEL description="AC worldserver image for local environment"
-
-CMD ./acore.sh run-worldserver
-
-USER $DOCKER_USER
+LABEL description "AzerothCore World Server"
-#================================================================
-#
-# BUILD: compile sources
-#
-#=================================================================
-FROM base as build
+ENV ACORE_COMPONENT=worldserver
+# Don't run database migrations. We can leave that up to the db-import container
+ENV AC_UPDATES_ENABLE_DATABASES=0
+# This disables user prompts. The console is still active, however
+ENV AC_DISABLE_INTERACTIVE=1
+ENV AC_CLOSE_IDLE_CONNECTIONS=0
-ARG DOCKER_USER=acore
-USER $DOCKER_USER
+COPY --chown=$DOCKER_USER:$DOCKER_USER \
+ --from=build \
+ /azerothcore/env/dist/bin/worldserver /azerothcore/env/dist/bin/worldserver
-LABEL description="AC Image used by the build stage to generate production images"
-
-RUN mkdir -p /azerothcore/env/etc/
-
-# .git is needed by the compiler
-COPY --chown=$DOCKER_USER:$DOCKER_USER ./.git /azerothcore/.git
-COPY --chown=$DOCKER_USER:$DOCKER_USER ./CMakeLists.txt /azerothcore/CMakeLists.txt
-COPY --chown=$DOCKER_USER:$DOCKER_USER ./deps /azerothcore/deps
-COPY --chown=$DOCKER_USER:$DOCKER_USER ./src /azerothcore/src
-COPY --chown=$DOCKER_USER:$DOCKER_USER ./modules /azerothcore/modules
-# check if we have ccache files available outside
-RUN rm -rf /azerothcore/var/ccache/*
-COPY --chown=$DOCKER_USER:$DOCKER_USER var/docker/ccache /azerothcore/var/ccache
-
-# install eluna
-RUN git clone --depth=1 --branch=master https://github.com/azerothcore/mod-eluna.git /azerothcore/modules/mod-eluna
-
-ENV USER_CONF_PATH=/azerothcore/apps/docker/config-docker.sh
-ENV CTYPE=RelWithDebInfo
-ENV AC_CCACHE=true
-ENV CCACHE_CPP2=true
-ENV CSCRIPTPCH=OFF
-ENV CCOREPCH=OFF
-ENV CTOOLS_BUILD=all
-# ENV CTOOLS_BUILD=maps-only
-ENV CSCRIPTS=static
-RUN bash apps/docker/docker-build-prod.sh
-
-#================================================================
-#
-# AUTH SERVICE: create a ready-to-use authserver image
-# with binaries included
-#
-#=================================================================
-FROM authserver-local as authserver
-
-LABEL description="AC Production: authserver"
+VOLUME /azerothcore/env/dist/etc
-ARG DOCKER_USER=acore
-USER $DOCKER_USER
+CMD ["worldserver"]
-COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/etc /azerothcore/env/dist/etc
-COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/authserver /azerothcore/env/dist/bin/authserver
+#############
+# DB Import #
+#############
-#================================================================
-#
-# WORLD SERVICE: create a ready-to-use worldserver image
-# with binaries and data included
-#
-#=================================================================
-FROM worldserver-local as worldserver
+FROM runtime as db-import
-LABEL description="AC Production: worldserver"
+LABEL description "AzerothCore Database Import tool"
-ARG DOCKER_USER=acore
USER $DOCKER_USER
-RUN mkdir -p /azerothcore/env/dist/bin/lua_scripts
-COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/etc /azerothcore/env/dist/etc
-COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/worldserver /azerothcore/env/dist/bin/worldserver
-COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/lua_scripts /azerothcore/env/dist/bin/lua_scripts
-COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/dbimport /azerothcore/env/dist/bin/dbimport
+ENV ACORE_COMPONENT=dbimport
-#================================================================
-#
-# CLIENT DATA
-#
-#=================================================================
+COPY --chown=$DOCKER_USER:$DOCKER_USER \
+ data data
-FROM ubuntu:20.04 as client-data
-ARG USER_ID=1000
-ARG GROUP_ID=1000
-ARG DOCKER_USER=acore
-
-LABEL description="AC Production: client-data"
+COPY --chown=$DOCKER_USER:$DOCKER_USER\
+ --from=build \
+ /azerothcore/env/dist/bin/dbimport /azerothcore/env/dist/bin/dbimport
-RUN apt-get update && apt-get install -y tzdata curl unzip && rm -rf /var/lib/apt/lists/* ;
+CMD /azerothcore/env/dist/bin/dbimport
-# set timezone environment variable
-ENV TZ=Etc/UTC
+###############
+# Client Data #
+###############
-# set noninteractive mode so tzdata doesn't ask to set timezone on install
-ENV DEBIAN_FRONTEND=noninteractive
+FROM skeleton as client-data
-RUN addgroup --gid "$GROUP_ID" "$DOCKER_USER" && \
- adduser --disabled-password --gecos '' --uid "$USER_ID" --gid "$GROUP_ID" "$DOCKER_USER" && \
- passwd -d "$DOCKER_USER" && \
- echo "$DOCKER_USER ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers
+LABEL description="AzerothCore client-data"
-# ENV DATAPATH=/azerothcore/env/dist/data-temp
ENV DATAPATH=/azerothcore/env/dist/data
-ENV DATAPATH_ZIP=/tmp/data.zip
-RUN mkdir -p "$DATAPATH"
-ARG CACHEBUST=1
-# RUN --mount=type=bind,target=/azerothcore-temp,readwrite --mount=type=cache,target=/azerothcore/env/dist/data-temp /azerothcore-temp/acore.sh client-data && cp -rT /azerothcore/env/dist/data-temp/ /azerothcore/env/dist/data && chown -R $DOCKER_USER:$DOCKER_USER /azerothcore
-RUN --mount=type=bind,target=/azerothcore-temp,readwrite /azerothcore-temp/acore.sh client-data && chown -R $DOCKER_USER:$DOCKER_USER /azerothcore
+RUN apt-get update && \
+ apt-get install -y curl unzip && \
+ rm -rf /var/lib/apt/lists/*
-USER $DOCKER_USER
+COPY --chown=$DOCKER_USER:$DOCKER_USER apps apps
-#================================================================
-#
-# TOOLS
-#
-#=================================================================
+VOLUME /azerothcore/env/dist/data
-FROM ubuntu:20.04 as tools
-ARG USER_ID=1000
-ARG GROUP_ID=1000
-ARG DOCKER_USER=acore
-
-LABEL description="AC Production: tools"
-
-# List of timezones: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
+USER $DOCKER_USER
-# set timezone environment variable
-ENV TZ=Etc/UTC
+CMD bash -c "source /azerothcore/apps/installer/includes/functions.sh && inst_download_client_data"
-# set noninteractive mode so tzdata doesn't ask to set timezone on install
-ENV DEBIAN_FRONTEND=noninteractive
+##################
+# Map Extractors #
+##################
-RUN apt-get update && apt-get install -y libmysqlclient-dev libssl-dev libbz2-dev \
- libboost-system1.7*-dev libboost-filesystem1.7*-dev libboost-program-options1.7*-dev libboost-iostreams1.7*-dev \
- sudo && rm -rf /var/lib/apt/lists/* ;
+FROM runtime as tools
-# Create a non-root user
-RUN addgroup --gid "$GROUP_ID" "$DOCKER_USER" && \
- adduser --disabled-password --gecos '' --uid "$USER_ID" --gid "$GROUP_ID" "$DOCKER_USER" && \
- passwd -d "$DOCKER_USER" && \
- echo "$DOCKER_USER ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers
+LABEL description "AzerothCore Tools"
-RUN mkdir -p /azerothcore/env/client/
-RUN chown -R $DOCKER_USER:$DOCKER_USER /azerothcore
+WORKDIR /azerothcore/env/dist/
-USER $DOCKER_USER
+RUN mkdir -pv /azerothcore/env/dist/Cameras \
+ /azerothcore/env/dist/dbc \
+ /azerothcore/env/dist/maps \
+ /azerothcore/env/dist/mmaps \
+ /azerothcore/env/dist/vmaps
-WORKDIR /azerothcore/env/client/
+COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build \
+ /azerothcore/env/dist/bin/map_extractor /azerothcore/env/dist/map_extractor
-RUN mkdir -p /azerothcore/env/client/Cameras
-RUN mkdir -p /azerothcore/env/client/dbc
-RUN mkdir -p /azerothcore/env/client/maps
-RUN mkdir -p /azerothcore/env/client/mmaps
-RUN mkdir -p /azerothcore/env/client/vmaps
+COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build \
+ /azerothcore/env/dist/bin/mmaps_generator /azerothcore/env/dist/mmaps_generator
-COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/map_extractor /azerothcore/env/client/map_extractor
-COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/mmaps_generator /azerothcore/env/client/mmaps_generator
-COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/vmap4_assembler /azerothcore/env/client/vmap4_assembler
-COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/vmap4_extractor /azerothcore/env/client/vmap4_extractor
+COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build \
+ /azerothcore/env/dist/bin/vmap4_assembler /azerothcore/env/dist/vmap4_assembler
+COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build \
+ /azerothcore/env/dist/bin/vmap4_extractor /azerothcore/env/dist/vmap4_extractor
diff --git a/apps/docker/Dockerfile.dev-server b/apps/docker/Dockerfile.dev-server
new file mode 100644
index 0000000000..8924c4688d
--- /dev/null
+++ b/apps/docker/Dockerfile.dev-server
@@ -0,0 +1,83 @@
+#syntax=docker/dockerfile:1.2
+
+#================================================================
+#
+# DEV: Stage used for the development environment
+# and the locally built services
+#
+#=================================================================
+
+FROM ubuntu:22.04 as dev
+ARG USER_ID=1000
+ARG GROUP_ID=1000
+ARG DOCKER_USER=acore
+ARG TZ=Etc/UTC
+
+LABEL description="AC base image for dev containers"
+
+# List of timezones: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
+
+ENV DOCKER=1
+
+# Ensure ac-dev-server can properly pull versions
+ENV GIT_DISCOVERY_ACROSS_FILESYSTEM=1
+
+# set timezone environment variable
+ENV TZ=$TZ
+
+# set noninteractive mode so tzdata doesn't ask to set timezone on install
+ENV DEBIAN_FRONTEND=noninteractive
+
+RUN apt-get update \
+ && apt-get install -y \
+ gdb gdbserver git dos2unix lsb-core sudo curl unzip \
+ make cmake clang libmysqlclient-dev libboost-all-dev \
+ build-essential libtool cmake-data openssl libgoogle-perftools-dev google-perftools \
+ libssl-dev libmysql++-dev libreadline6-dev zlib1g-dev libbz2-dev mysql-client \
+ libncurses5-dev ccache tzdata \
+ && rm -rf /var/lib/apt/lists/*
+
+# Ensure git will work with the AzerothCore source directory
+RUN git config --global --add safe.directory /azerothcore
+
+# change timezone in container
+RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
+ && echo $TZ > /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata
+
+# Create a non-root user
+RUN addgroup --gid "$GROUP_ID" "$DOCKER_USER" && \
+ adduser --disabled-password --gecos '' --uid "$USER_ID" --gid "$GROUP_ID" "$DOCKER_USER" && \
+ passwd -d "$DOCKER_USER" && \
+ echo "$DOCKER_USER ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers
+
+# must be created to set the correct permissions on them
+RUN mkdir -p \
+ /azerothcore/env/dist/bin \
+ /azerothcore/env/dist/data/Cameras \
+ /azerothcore/env/dist/data/dbc \
+ /azerothcore/env/dist/data/maps \
+ /azerothcore/env/dist/data/mmaps \
+ /azerothcore/env/dist/data/vmaps \
+ /azerothcore/env/dist/logs \
+ /azerothcore/env/dist/temp \
+ /azerothcore/env/dist/etc \
+ /azerothcore/var/build/obj
+
+# Correct permissions for non-root operations
+RUN chown -R $DOCKER_USER:$DOCKER_USER /home/acore /run /opt /azerothcore
+
+USER $DOCKER_USER
+
+# copy only necessary files for the acore dashboard
+COPY --chown=$DOCKER_USER:$DOCKER_USER apps /azerothcore/apps
+COPY --chown=$DOCKER_USER:$DOCKER_USER bin /azerothcore/bin
+COPY --chown=$DOCKER_USER:$DOCKER_USER conf /azerothcore/conf
+COPY --chown=$DOCKER_USER:$DOCKER_USER data /azerothcore/data
+COPY --chown=$DOCKER_USER:$DOCKER_USER deps /azerothcore/deps
+COPY --chown=$DOCKER_USER:$DOCKER_USER acore.json /azerothcore/acore.json
+COPY --chown=$DOCKER_USER:$DOCKER_USER acore.sh /azerothcore/acore.sh
+
+# Download deno and make sure the dashboard works
+RUN bash /azerothcore/acore.sh quit
+
+WORKDIR /azerothcore
diff --git a/apps/docker/README.md b/apps/docker/README.md
index 80cd4fa100..546cbbfaa6 100644
--- a/apps/docker/README.md
+++ b/apps/docker/README.md
@@ -1,27 +1,41 @@
-# Run AzerothCore with Docker
+# Docker
-*This readme it's a summary of the AzerothCore docker features.*
+Full documentation is [on our wiki](https://www.azerothcore.org/wiki/install-with-docker#installation)
-Docker. is a software that performs operating-system-level virtualization, allowing to wrap and launch applications inside containers.
+## Building
-Thanks to Docker, you can quickly setup and run AzerothCore in any operating system.
+### Prerequisites
-The **only** requirement is having [Docker](https://docs.docker.com/install/) installed into your system. Forget about installing mysql, visual studio, cmake, etc...
+Ensure that you have docker, docker compose (v2), and the docker buildx command
+installed.
-### Installation instructions
+It's all bundled with [Docker Desktop](https://docs.docker.com/get-docker/),
+though if you're using Linux you can install them through your distribution's
+package manage or by using the [documentation from docker](https://docs.docker.com/engine/install/)
-Check the [Install with Docker](https://www.azerothcore.org/wiki/Install-with-Docker) guide.
+### Running the Build
-### Memory usage
+1. Build containers with command
-The total amount of RAM when running all AzerothCore docker containers is **less than 2 GB**.
+```console
+$ docker compose build
+```
-![AzerothCore containers memory](https://user-images.githubusercontent.com/75517/51078287-10e65b80-16b3-11e9-807f-f59a5844dae5.png)
+ 1. Note that the initial build will take a long time, though subsequent builds should be faster
+2. Start containers with command
-### Docker containers vs Virtual machines
+```console
+$ docker compose up -d
+# Skip the build step
+$ docker compose up -d --build
+```
-Using Docker will have the same benefits as using virtual machines, but with much less overhead:
+ 1. Note that this command may take a while the first time, for the database import
-![Docker containers vs Virtual machines](https://user-images.githubusercontent.com/75517/51078179-d4fec680-16b1-11e9-8ce6-87b5053f55dd.png)
+3. (on first install) You'll need to attach to the worldserver and create an Admin account
+```console
+$ docker compose attach ac-worldserver
+AC> account create admin password 3 -1
+```
diff --git a/apps/docker/config-docker.sh b/apps/docker/config-docker.sh
deleted file mode 100644
index 7f5482480d..0000000000
--- a/apps/docker/config-docker.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-CUR_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-
-CTOOLS_BUILD=all
-
-# allow the user to override configs
-if [ -f "$AC_PATH_CONF/config.sh" ]; then
- source "$AC_PATH_CONF/config.sh" # should overwrite previous
-fi
diff --git a/apps/docker/docker-build-dev.sh b/apps/docker/docker-build-dev.sh
deleted file mode 100644
index ced35c437d..0000000000
--- a/apps/docker/docker-build-dev.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/usr/bin/env bash
-
-CUR_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-
-source "$CUR_PATH/docker-build-prod.sh"
-
-echo "Fixing EOL..."
-# using -n (new file mode) should also fix the issue
-# when the file is created with the default acore user but you
-# set a different user into the docker configurations
-for file in "env/dist/etc/"*
-do
- dos2unix -n $file $file
-done
diff --git a/apps/docker/docker-build-prod.sh b/apps/docker/docker-build-prod.sh
deleted file mode 100755
index 07a42474b4..0000000000
--- a/apps/docker/docker-build-prod.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/usr/bin/env bash
-
-cd /azerothcore
-
-bash acore.sh compiler build
diff --git a/apps/docker/docker-cmd.sh b/apps/docker/docker-cmd.sh
index 3a75174adc..c3b61a067e 100644
--- a/apps/docker/docker-cmd.sh
+++ b/apps/docker/docker-cmd.sh
@@ -54,7 +54,7 @@ while [[ $# -gt 0 ]]; do
case "$1" in
start:app)
set -x
- docker compose --profile app up
+ docker compose up
set +x
# pop the head off of the queue of args
# After this, the value of $1 is the value of $2
@@ -63,102 +63,138 @@ while [[ $# -gt 0 ]]; do
start:app:d)
set -x
- docker compose --profile app up -d
+ docker compose up -d
set +x
shift
;;
build)
set -x
- docker compose --profile local --profile dev --profile dev-build build
- docker compose --profile dev-build run --rm --no-deps ac-dev-build /bin/bash /azerothcore/apps/docker/docker-build-dev.sh
+ docker compose build
set +x
shift
;;
pull)
set -x
- docker compose --profile local --profile dev --profile dev-build pull
+ docker compose pull
set +x
shift
;;
build:nocache)
set -x
- docker compose --profile local --profile dev --profile dev-build build --no-cache
- docker compose run --rm --no-deps ac-dev-build /bin/bash /azerothcore/apps/docker/docker-build-dev.sh
+ docker compose build --no-cache
set +x
shift
;;
clean:build)
set -x
- docker compose run --rm --no-deps ac-dev-server bash acore.sh compiler clean
- docker compose run --rm --no-deps ac-dev-server bash acore.sh compiler ccacheClean
+ # Don't run 'docker buildx prune' since it may "escape" our bubble
+ # and affect other projects on the user's workstation/server
+ cat <<EOF
+This command has been deprecated, and at the moment does not do anything.
+If you'd like to build without cache, use the command './acore.sh docker build:nocache' or look into the 'docker buildx prune command'
+
+> https://docs.docker.com/engine/reference/commandline/buildx_prune/
+EOF
set +x
shift
;;
client-data)
set -x
- docker compose run --rm --no-deps ac-dev-server bash acore.sh client-data
+ docker compose up ac-client-data-init
set +x
shift
;;
dev:up)
set -x
- docker compose up -d ac-dev-server
+ docker compose --profile dev up ac-dev-server -d
set +x
shift
;;
dev:build)
set -x
- docker compose run --rm ac-dev-server bash acore.sh compiler build
+ docker compose --profile dev run --rm ac-dev-server bash /azerothcore/acore.sh compiler build
set +x
shift
;;
dev:dash)
set -x
- docker compose run --rm ac-dev-server bash /azerothcore/acore.sh ${@:2}
+ docker compose --profile dev run --rm ac-dev-server bash /azerothcore/acore.sh ${@:2}
set +x
shift
;;
dev:shell)
set -x
- docker compose up -d ac-dev-server
- docker compose exec ac-dev-server bash ${@:2}
+ docker compose --profile dev up -d ac-dev-server
+ docker compose --profile dev exec ac-dev-server bash ${@:2}
set +x
shift
;;
build:prod|prod:build)
+ cat <<EOF
+This command is deprecated and is scheduled to be removed. Please update any scripts or automation accordingly to use the other command:
+
+ ./acore.sh docker build
+
+The build will continue in 3 seconds
+EOF
+ sleep 3
set -x
- docker compose --profile prod build
+ docker compose build
set +x
shift
;;
pull:prod|prod:pull)
+ cat <<EOF
+This command is deprecated and is scheduled to be removed. Please update any scripts or automation accordingly to use the other command:
+
+ ./acore.sh docker pull
+
+The image pull will continue in 3 seconds
+EOF
+ sleep 3
set -x
- docker compose --profile prod pull
+ docker compose pull
set +x
shift
;;
prod:up|start:prod)
+ cat <<EOF
+This command is deprecated and is scheduled to be removed. Please update any scripts or automation accordingly to use the other command:
+
+ ./acore.sh docker start:app
+
+The containers will start in 3 seconds
+EOF
+ sleep 3
set -x
- docker compose --profile prod-app up
+ docker compose up
set +x
shift
;;
prod:up:d|start:prod:d)
+ cat <<EOF
+This command is deprecated and is scheduled to be removed. Please update any scripts or automation accordingly to use the other command:
+
+ ./acore.sh docker start:app:d
+
+The containers will start in 3 seconds
+EOF
+ sleep 3
set -x
- docker compose --profile prod-app up -d
+ docker compose up -d
set +x
shift
;;
diff --git a/apps/docker/entrypoint.sh b/apps/docker/entrypoint.sh
new file mode 100644
index 0000000000..62504fc0de
--- /dev/null
+++ b/apps/docker/entrypoint.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+set -euo pipefail
+
+# Copy all default config files to env/dist/etc if they don't already exist
+# -r == recursive
+# -n == no clobber (don't overwrite)
+# -v == be verbose
+cp -rnv /azerothcore/env/ref/etc/* /azerothcore/env/dist/etc
+
+CONF="/azerothcore/env/dist/etc/$ACORE_COMPONENT.conf"
+CONF_DIST="/azerothcore/env/dist/etc/$ACORE_COMPONENT.conf.dist"
+
+# Copy the "dist" file to the "conf" if the conf doesn't already exist
+if [[ -f "$CONF_DIST" ]]; then
+ cp -vn "$CONF_DIST" "$CONF"
+else
+ touch "$CONF"
+fi
+
+echo "Starting $ACORE_COMPONENT..."
+
+exec "$@"