mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2025-11-29 17:38:24 +08:00
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
This commit is contained in:
@@ -1,344 +1,255 @@
|
||||
#syntax=docker/dockerfile:1.2
|
||||
ARG UBUNTU_VERSION=22.04 # lts
|
||||
ARG TZ=Etc/UTC
|
||||
|
||||
#================================================================
|
||||
#
|
||||
# DEV: Stage used for the development environment
|
||||
# and the locally built services
|
||||
#
|
||||
#=================================================================
|
||||
# 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
|
||||
|
||||
FROM ubuntu:20.04 as base
|
||||
ARG USER_ID=1000
|
||||
ARG GROUP_ID=1000
|
||||
ARG DOCKER_USER=acore
|
||||
ARG DOCKER=1
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
LABEL description="AC base image for dev containers"
|
||||
ENV TZ=$TZ
|
||||
ENV AC_FORCE_CREATE_DB=1
|
||||
|
||||
# List of timezones: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
||||
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
|
||||
|
||||
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
|
||||
# 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
|
||||
#
|
||||
#=================================================================
|
||||
# This target builds the docker image
|
||||
# This target can be useful to inspect the explicit outputs from the build,
|
||||
FROM skeleton as build
|
||||
|
||||
FROM base as dev
|
||||
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
|
||||
|
||||
LABEL description="AC dev image for dev containers"
|
||||
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=""
|
||||
|
||||
USER $DOCKER_USER
|
||||
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 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
|
||||
COPY CMakeLists.txt /azerothcore/CMakeLists.txt
|
||||
COPY conf /azerothcore/conf
|
||||
COPY deps /azerothcore/deps
|
||||
COPY src /azerothcore/src
|
||||
COPY modules /azerothcore/modules
|
||||
|
||||
#================================================================
|
||||
#
|
||||
# SERVICE BASE: prepare the OS for the production-ready services
|
||||
#
|
||||
#=================================================================
|
||||
|
||||
FROM ubuntu:20.04 as servicebase
|
||||
|
||||
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
|
||||
|
||||
# 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
|
||||
|
||||
# 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/* ;
|
||||
|
||||
# change timezone in container
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata
|
||||
|
||||
# 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
|
||||
|
||||
COPY --chown=$DOCKER_USER:$DOCKER_USER --from=base /azerothcore /azerothcore
|
||||
|
||||
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
|
||||
|
||||
# Download deno and make sure the dashboard works
|
||||
RUN bash /azerothcore/acore.sh quit
|
||||
|
||||
WORKDIR /azerothcore/
|
||||
|
||||
#================================================================
|
||||
#
|
||||
# AUTH & WORLD local: images used for local services
|
||||
# These images don't include binaries by default
|
||||
#
|
||||
#=================================================================
|
||||
|
||||
FROM servicebase as authserver-local
|
||||
|
||||
LABEL description="AC authserver image for local environment"
|
||||
|
||||
CMD ./acore.sh run-authserver
|
||||
|
||||
USER $DOCKER_USER
|
||||
|
||||
FROM servicebase as worldserver-local
|
||||
|
||||
LABEL description="AC worldserver image for local environment"
|
||||
|
||||
CMD ./acore.sh run-worldserver
|
||||
|
||||
USER $DOCKER_USER
|
||||
|
||||
#================================================================
|
||||
#
|
||||
# BUILD: compile sources
|
||||
#
|
||||
#=================================================================
|
||||
FROM base as build
|
||||
|
||||
ARG DOCKER_USER=acore
|
||||
USER $DOCKER_USER
|
||||
|
||||
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"
|
||||
|
||||
ARG DOCKER_USER=acore
|
||||
USER $DOCKER_USER
|
||||
|
||||
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
|
||||
|
||||
#================================================================
|
||||
#
|
||||
# WORLD SERVICE: create a ready-to-use worldserver image
|
||||
# with binaries and data included
|
||||
#
|
||||
#=================================================================
|
||||
FROM worldserver-local as worldserver
|
||||
|
||||
LABEL description="AC Production: worldserver"
|
||||
|
||||
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
|
||||
|
||||
#================================================================
|
||||
#
|
||||
# CLIENT 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"
|
||||
|
||||
RUN apt-get update && apt-get install -y tzdata curl unzip && rm -rf /var/lib/apt/lists/* ;
|
||||
|
||||
# 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
|
||||
|
||||
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
|
||||
|
||||
# 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
|
||||
|
||||
USER $DOCKER_USER
|
||||
WORKDIR /azerothcore/build
|
||||
|
||||
#================================================================
|
||||
#
|
||||
# TOOLS
|
||||
#
|
||||
#=================================================================
|
||||
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
|
||||
|
||||
FROM ubuntu:20.04 as tools
|
||||
ARG USER_ID=1000
|
||||
ARG GROUP_ID=1000
|
||||
ARG DOCKER_USER=acore
|
||||
|
||||
LABEL description="AC Production: tools"
|
||||
ENV ACORE_COMPONENT=undefined
|
||||
|
||||
# List of timezones: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
||||
# 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 timezone environment variable
|
||||
ENV TZ=Etc/UTC
|
||||
COPY --from=build /azerothcore/env/dist/etc/ /azerothcore/env/ref/etc
|
||||
|
||||
# set noninteractive mode so tzdata doesn't ask to set timezone on install
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
VOLUME /azerothcore/env/dist/etc
|
||||
|
||||
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/* ;
|
||||
ENV PATH="/azerothcore/env/dist/bin:$PATH"
|
||||
|
||||
# Create a non-root user
|
||||
RUN addgroup --gid "$GROUP_ID" "$DOCKER_USER" && \
|
||||
adduser --disabled-password --gecos '' --uid "$USER_ID" --gid "$GROUP_ID" "$DOCKER_USER" && \
|
||||
RUN groupadd --gid "$GROUP_ID" "$DOCKER_USER" && \
|
||||
useradd -d /azerothcore --uid "$USER_ID" --gid "$GROUP_ID" "$DOCKER_USER" && \
|
||||
passwd -d "$DOCKER_USER" && \
|
||||
echo "$DOCKER_USER ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers
|
||||
chown -R "$DOCKER_USER:$DOCKER_USER" /azerothcore
|
||||
|
||||
RUN mkdir -p /azerothcore/env/client/
|
||||
RUN chown -R $DOCKER_USER:$DOCKER_USER /azerothcore
|
||||
COPY apps/docker/entrypoint.sh /entrypoint.sh
|
||||
RUN chmod -v +x /entrypoint.sh
|
||||
|
||||
USER $DOCKER_USER
|
||||
|
||||
WORKDIR /azerothcore/env/client/
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
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
|
||||
###############
|
||||
# Auth Server #
|
||||
###############
|
||||
|
||||
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
|
||||
FROM runtime as authserver
|
||||
LABEL description "AzerothCore Auth Server"
|
||||
|
||||
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
|
||||
|
||||
COPY --chown=$DOCKER_USER:$DOCKER_USER \
|
||||
--from=build \
|
||||
/azerothcore/env/dist/bin/authserver /azerothcore/env/dist/bin/authserver
|
||||
|
||||
|
||||
CMD ["authserver"]
|
||||
|
||||
################
|
||||
# World Server #
|
||||
################
|
||||
|
||||
FROM runtime as worldserver
|
||||
|
||||
LABEL description "AzerothCore World Server"
|
||||
|
||||
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
|
||||
|
||||
COPY --chown=$DOCKER_USER:$DOCKER_USER \
|
||||
--from=build \
|
||||
/azerothcore/env/dist/bin/worldserver /azerothcore/env/dist/bin/worldserver
|
||||
|
||||
VOLUME /azerothcore/env/dist/etc
|
||||
|
||||
CMD ["worldserver"]
|
||||
|
||||
#############
|
||||
# DB Import #
|
||||
#############
|
||||
|
||||
FROM runtime as db-import
|
||||
|
||||
LABEL description "AzerothCore Database Import tool"
|
||||
|
||||
USER $DOCKER_USER
|
||||
|
||||
ENV ACORE_COMPONENT=dbimport
|
||||
|
||||
COPY --chown=$DOCKER_USER:$DOCKER_USER \
|
||||
data data
|
||||
|
||||
COPY --chown=$DOCKER_USER:$DOCKER_USER\
|
||||
--from=build \
|
||||
/azerothcore/env/dist/bin/dbimport /azerothcore/env/dist/bin/dbimport
|
||||
|
||||
CMD /azerothcore/env/dist/bin/dbimport
|
||||
|
||||
###############
|
||||
# Client Data #
|
||||
###############
|
||||
|
||||
FROM skeleton as client-data
|
||||
|
||||
LABEL description="AzerothCore client-data"
|
||||
|
||||
ENV DATAPATH=/azerothcore/env/dist/data
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y curl unzip && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --chown=$DOCKER_USER:$DOCKER_USER apps apps
|
||||
|
||||
VOLUME /azerothcore/env/dist/data
|
||||
|
||||
USER $DOCKER_USER
|
||||
|
||||
CMD bash -c "source /azerothcore/apps/installer/includes/functions.sh && inst_download_client_data"
|
||||
|
||||
##################
|
||||
# Map Extractors #
|
||||
##################
|
||||
|
||||
FROM runtime as tools
|
||||
|
||||
LABEL description "AzerothCore Tools"
|
||||
|
||||
WORKDIR /azerothcore/env/dist/
|
||||
|
||||
RUN mkdir -pv /azerothcore/env/dist/Cameras \
|
||||
/azerothcore/env/dist/dbc \
|
||||
/azerothcore/env/dist/maps \
|
||||
/azerothcore/env/dist/mmaps \
|
||||
/azerothcore/env/dist/vmaps
|
||||
|
||||
COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build \
|
||||
/azerothcore/env/dist/bin/map_extractor /azerothcore/env/dist/map_extractor
|
||||
|
||||
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/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
|
||||
|
||||
83
apps/docker/Dockerfile.dev-server
Normal file
83
apps/docker/Dockerfile.dev-server
Normal file
@@ -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
|
||||
@@ -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
|
||||
```
|
||||
|
||||

|
||||
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
|
||||
|
||||

|
||||
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
|
||||
```
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cd /azerothcore
|
||||
|
||||
bash acore.sh compiler build
|
||||
@@ -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
|
||||
;;
|
||||
|
||||
22
apps/docker/entrypoint.sh
Normal file
22
apps/docker/entrypoint.sh
Normal file
@@ -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 "$@"
|
||||
Reference in New Issue
Block a user