2021-04-22 09:57:05 +02:00
|
|
|
#================================================================
|
|
|
|
|
#
|
|
|
|
|
# DEV: Stage used for the development environment
|
|
|
|
|
# and the locally built services
|
|
|
|
|
#
|
|
|
|
|
#=================================================================
|
|
|
|
|
|
2021-04-28 22:26:39 +02:00
|
|
|
FROM ubuntu:20.04 as base
|
2021-04-22 09:57:05 +02:00
|
|
|
ARG USER_ID=1000
|
|
|
|
|
ARG GROUP_ID=1000
|
2021-04-28 22:26:39 +02:00
|
|
|
ARG DOCKER_USER=acore
|
2021-04-22 09:57:05 +02:00
|
|
|
|
2021-04-28 22:26:39 +02:00
|
|
|
LABEL description="AC base image for dev containers"
|
2021-04-22 09:57:05 +02:00
|
|
|
|
|
|
|
|
# List of timezones: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
|
|
|
|
|
|
|
|
|
ENV DOCKER=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
|
|
|
|
|
|
2021-04-28 22:26:39 +02:00
|
|
|
# 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 libace-dev \
|
|
|
|
|
build-essential libtool cmake-data openssl libgoogle-perftools-dev \
|
|
|
|
|
libssl-dev libmysql++-dev libreadline6-dev zlib1g-dev libbz2-dev mysql-client \
|
|
|
|
|
libncurses5-dev ccache \
|
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
2021-04-22 09:57:05 +02:00
|
|
|
|
|
|
|
|
# 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 acore && \
|
|
|
|
|
adduser --disabled-password --gecos '' --uid $USER_ID --gid $GROUP_ID acore && \
|
|
|
|
|
passwd -d acore && \
|
|
|
|
|
echo 'acore ALL=(ALL:ALL) NOPASSWD: ALL' >> /etc/sudoers
|
|
|
|
|
|
2021-04-28 22:26:39 +02:00
|
|
|
# must be created to set the correct permissions on them
|
|
|
|
|
RUN mkdir -p /azerothcore/env/dist/data
|
|
|
|
|
RUN mkdir -p /azerothcore/env/dist/logs
|
|
|
|
|
RUN mkdir -p /azerothcore/env/dist/etc
|
|
|
|
|
RUN mkdir -p /azerothcore/var/build
|
2021-04-22 09:57:05 +02:00
|
|
|
|
|
|
|
|
# Correct permissions for non-root operations
|
2021-04-28 22:26:39 +02:00
|
|
|
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
|
2021-04-22 09:57:05 +02:00
|
|
|
|
2021-04-28 22:26:39 +02:00
|
|
|
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
|
2021-04-22 09:57:05 +02:00
|
|
|
|
|
|
|
|
WORKDIR /azerothcore
|
|
|
|
|
|
|
|
|
|
#================================================================
|
|
|
|
|
#
|
2021-04-28 22:26:39 +02:00
|
|
|
# Dev: create dev server image
|
2021-04-22 09:57:05 +02:00
|
|
|
#
|
|
|
|
|
#=================================================================
|
|
|
|
|
|
2021-04-28 22:26:39 +02:00
|
|
|
FROM base as dev
|
|
|
|
|
|
|
|
|
|
LABEL description="AC dev image for dev containers"
|
2021-04-22 09:57:05 +02:00
|
|
|
|
|
|
|
|
#================================================================
|
|
|
|
|
#
|
|
|
|
|
# SERVICE BASE: prepare the OS for the production-ready services
|
|
|
|
|
#
|
|
|
|
|
#=================================================================
|
|
|
|
|
|
|
|
|
|
FROM ubuntu:20.04 as servicebase
|
|
|
|
|
|
2021-04-28 22:26:39 +02:00
|
|
|
ARG USER_ID=1000
|
|
|
|
|
ARG GROUP_ID=1000
|
|
|
|
|
ARG DOCKER_USER=acore
|
|
|
|
|
|
|
|
|
|
LABEL description="AC service image for server applications"
|
|
|
|
|
|
2021-04-22 09:57:05 +02:00
|
|
|
# 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
|
|
|
|
|
|
2021-04-28 22:26:39 +02:00
|
|
|
# Create a non-root user
|
|
|
|
|
RUN addgroup --gid $GROUP_ID acore && \
|
|
|
|
|
adduser --disabled-password --gecos '' --uid $USER_ID --gid $GROUP_ID acore && \
|
|
|
|
|
passwd -d acore && \
|
|
|
|
|
echo 'acore ALL=(ALL:ALL) NOPASSWD: ALL' >> /etc/sudoers
|
2021-04-22 09:57:05 +02:00
|
|
|
|
2021-04-28 22:26:39 +02:00
|
|
|
# install the required dependencies to run the server
|
|
|
|
|
RUN apt-get update && apt-get install -y dos2unix gdb gdbserver net-tools tzdata libmysqlclient-dev libace-dev mysql-client curl unzip && rm -rf /var/lib/apt/lists/* ;
|
2021-04-22 09:57:05 +02:00
|
|
|
|
|
|
|
|
# change timezone in container
|
|
|
|
|
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata
|
|
|
|
|
|
2021-04-28 22:26:39 +02:00
|
|
|
# copy the sources from the host machine
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
# 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 $DOCKER_USER:$DOCKER_USER /azerothcore
|
|
|
|
|
|
|
|
|
|
USER $DOCKER_USER
|
|
|
|
|
|
|
|
|
|
# must be created to avoid permissions errors
|
|
|
|
|
RUN mkdir -p /azerothcore/env/dist/data
|
|
|
|
|
RUN mkdir -p /azerothcore/env/dist/logs
|
|
|
|
|
RUN mkdir -p /azerothcore/env/dist/etc
|
|
|
|
|
RUN mkdir -p /azerothcore/env/dist/bin
|
|
|
|
|
|
2021-04-22 09:57:05 +02:00
|
|
|
WORKDIR /azerothcore/
|
|
|
|
|
|
2021-04-28 22:26:39 +02:00
|
|
|
#================================================================
|
|
|
|
|
#
|
|
|
|
|
# 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
|
|
|
|
|
|
|
|
|
|
FROM servicebase as worldserver-local
|
|
|
|
|
|
|
|
|
|
LABEL description="AC worldserver image for local environment"
|
|
|
|
|
|
|
|
|
|
CMD ./acore.sh run-worldserver
|
|
|
|
|
|
|
|
|
|
#================================================================
|
|
|
|
|
#
|
|
|
|
|
# BUILD: compile sources
|
|
|
|
|
#
|
|
|
|
|
#=================================================================
|
|
|
|
|
FROM base as build
|
|
|
|
|
|
|
|
|
|
LABEL description="AC Image used by the build stage to generate production images"
|
|
|
|
|
|
|
|
|
|
RUN bash bin/acore-docker-build
|
2021-04-22 09:57:05 +02:00
|
|
|
|
|
|
|
|
#================================================================
|
|
|
|
|
#
|
|
|
|
|
# AUTH SERVICE: create a ready-to-use authserver image
|
2021-04-28 22:26:39 +02:00
|
|
|
# with binaries included
|
2021-04-22 09:57:05 +02:00
|
|
|
#
|
|
|
|
|
#=================================================================
|
2021-04-28 22:26:39 +02:00
|
|
|
FROM authserver-local as authserver
|
2021-04-22 09:57:05 +02:00
|
|
|
|
2021-04-28 22:26:39 +02:00
|
|
|
LABEL description="AC Production ready authserver"
|
2021-04-22 09:57:05 +02:00
|
|
|
|
2021-04-28 22:26:39 +02:00
|
|
|
ARG DOCKER_USER=acore
|
|
|
|
|
|
|
|
|
|
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
|
2021-04-22 09:57:05 +02:00
|
|
|
|
|
|
|
|
#================================================================
|
|
|
|
|
#
|
|
|
|
|
# WORLD SERVICE: create a ready-to-use worldserver image
|
2021-04-28 22:26:39 +02:00
|
|
|
# with binaries and data included
|
2021-04-22 09:57:05 +02:00
|
|
|
#
|
|
|
|
|
#=================================================================
|
2021-04-28 22:26:39 +02:00
|
|
|
FROM authserver-local as worldserver
|
2021-04-22 09:57:05 +02:00
|
|
|
|
2021-04-28 22:26:39 +02:00
|
|
|
LABEL description="AC Production ready worldserver"
|
2021-04-22 09:57:05 +02:00
|
|
|
|
2021-04-28 22:26:39 +02:00
|
|
|
ARG DOCKER_USER=acore
|
2021-04-22 09:57:05 +02:00
|
|
|
|
2021-04-28 22:26:39 +02:00
|
|
|
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
|
2021-04-22 09:57:05 +02:00
|
|
|
|
2021-04-28 22:26:39 +02:00
|
|
|
ENV DATAPATH=/azerothcore/env/dist/data
|
2021-04-22 09:57:05 +02:00
|
|
|
|
2021-04-28 22:26:39 +02:00
|
|
|
RUN /azerothcore/acore.sh client-data
|
2021-04-22 09:57:05 +02:00
|
|
|
|