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:
Mike Delago
2023-10-15 08:47:09 -07:00
committed by GitHub
parent d1d46074a6
commit c4dc20a814
12 changed files with 680 additions and 838 deletions

View File

@@ -0,0 +1,38 @@
name: docker tag and build
description: a helper action to shorten generating docker tags and building
inputs:
component-name:
description: name of the component/docker image (eg worldserver, authserver)
type: string
required: true
push:
description: whether to push the image or not
type: boolean
required: true
version:
description: version tag to use for docker image
required: true
type: string
runs:
using: composite
steps:
- name: Get Docker Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: acore/ac-wotlk-${{ inputs.component-name }}
tags: |
type=raw,value=${{ inputs.version }}
type=ref,event=branch
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ${{ github.workspace }}
file: apps/docker/Dockerfile
push: ${{ inputs.push }}
tags: ${{ steps.meta.outputs.tags }}
build-args: |
USER_ID=1000
GROUP_ID=1000
DOCKER_USER=acore

View File

@@ -4,7 +4,11 @@ on:
branches:
- 'master'
pull_request:
types: ['labeled', 'opened', 'synchronize', 'reopened']
types:
- labeled
- opened
- synchronize
- reopened
concurrency:
group: ${{ github.head_ref }} || concat(${{ github.ref }}, ${{ github.workflow }})
@@ -12,41 +16,24 @@ concurrency:
jobs:
docker-build-n-deploy-dev:
strategy:
fail-fast: true
matrix:
os: [ubuntu-20.04]
runs-on: ${{ matrix.os }}
runs-on: "ubuntu-latest"
if: |
github.repository == 'azerothcore/azerothcore-wotlk'
&& !github.event.pull_request.draft
&& (github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'run-build') || github.event.label.name == 'run-build')
&& (github.ref_name == 'master' || contains(github.event.pull_request.labels.*.name, 'run-build') || github.event.label.name == 'run-build')
env:
COMPOSE_DOCKER_CLI_BUILD: 1
DOCKER_BUILDKIT: 1
steps:
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Configure
- name: Free up disk space
run: |
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
docker --version
docker compose version
- uses: actions/checkout@v4
# we need the entire history for the ac-dev-server
# with:
# fetch-depth: 2
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
if: github.repository == 'azerothcore/azerothcore-wotlk' && steps.extract_branch.outputs.branch == 'master'
@@ -55,123 +42,116 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build Dev
if: github.repository == 'azerothcore/azerothcore-wotlk'
env:
#DOCKER_IMAGE_TAG: ${{ steps.extract_branch.outputs.branch }}
DOCKER_CLIENT_TIMEOUT: 400
COMPOSE_HTTP_TIMEOUT: 400
- name: Get version
id: version
run: |
export DOCKER_USER_ID=$(id -u)
export DOCKER_GROUP_ID=$(id -u)
# pull the images first to load the docker cache layers
#./acore.sh docker pull
./acore.sh docker build
output=$(./acore.sh version | grep "AzerothCore Rev. ") && version=${output#"AzerothCore Rev. "}
DOCKER_IMAGE_TAG=$version docker compose --profile dev --profile local build
output=$(./acore.sh version | grep "AzerothCore Rev. ")
version=${output#"AzerothCore Rev. "}
echo "version=$version" >> $GITHUB_OUTPUT
- name: Deploy Dev
#env:
# DOCKER_IMAGE_TAG: ${{ steps.extract_branch.outputs.branch }}
if: github.repository == 'azerothcore/azerothcore-wotlk' && steps.extract_branch.outputs.branch == 'master'
run: |
docker compose --profile dev --profile local push
output=$(./acore.sh version | grep "AzerothCore Rev. ") && version=${output#"AzerothCore Rev. "}
DOCKER_IMAGE_TAG=$version docker compose --profile dev --profile local push
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: acore/ac-wotlk-dev-server
tags: |
type=raw,value=${{ steps.version.outputs.version }}
type=ref,event=branch
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ${{ github.workspace }}
file: apps/docker/Dockerfile.dev-server
push: ${{ github.repository == 'azerothcore/azerothcore-wotlk' && github.ref_name == 'master' }}
tags: ${{ steps.meta.outputs.tags }}
build-args: |
USER_ID=1000
GROUP_ID=1000
DOCKER_USER=acore
# TODO: rename this job
docker-build-n-deploy-prod:
strategy:
fail-fast: true
matrix:
os: [ubuntu-20.04]
runs-on: ${{ matrix.os }}
runs-on: "ubuntu-latest"
if: |
github.repository == 'azerothcore/azerothcore-wotlk'
&& !github.event.pull_request.draft
&& (github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'run-build') || github.event.label.name == 'run-build')
&& (github.ref_name == 'master' || contains(github.event.pull_request.labels.*.name, 'run-build') || github.event.label.name == 'run-build')
env:
COMPOSE_DOCKER_CLI_BUILD: 1
DOCKER_BUILDKIT: 1
steps:
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Configure
- name: Free up disk space
run: |
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
docker --version
docker compose version
- uses: actions/checkout@v4
# we need the entire history for the ac-dev-server
# with:
# fetch-depth: 2
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
if: github.repository == 'azerothcore/azerothcore-wotlk' && steps.extract_branch.outputs.branch == 'master'
if: github.repository == 'azerothcore/azerothcore-wotlk' && github.ref_name == 'master'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Cache
uses: actions/cache@v3
- name: Get version
id: version
run: |
output=$(./acore.sh version | grep "AzerothCore Rev. ")
version=${output#"AzerothCore Rev. "}
echo "version=$version" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: build worldserver
uses: ./.github/actions/docker-tag-and-build
with:
path: var/docker/ccache
key: ccache:${{ matrix.os }}:clang:without-modules:${{ github.ref }}:${{ github.sha }}
restore-keys: |
ccache:${{ matrix.os }}:clang:without-modules:${{ github.ref }}
ccache:${{ matrix.os }}:clang:without-modules
component-name: worldserver
version: ${{ steps.version.outputs.version }}
push: ${{ github.repository == 'azerothcore/azerothcore-wotlk' && github.ref_name == 'master' }}
- name: Build Production images
if: github.repository == 'azerothcore/azerothcore-wotlk'
env:
#DOCKER_IMAGE_TAG: ${{ steps.extract_branch.outputs.branch }}
DOCKER_CLIENT_TIMEOUT: 220
COMPOSE_HTTP_TIMEOUT: 220
run: |
export DOCKER_USER_ID=$(id -u)
export DOCKER_GROUP_ID=$(id -u)
# pull the images first to load the docker cache layers
#./acore.sh docker prod:pull
./acore.sh docker prod:build
output=$(./acore.sh version | grep "AzerothCore Rev. ") && version=${output#"AzerothCore Rev. "}
DOCKER_IMAGE_TAG=$version ./acore.sh docker prod:build
# create the container to allow the copy right after
docker compose create ac-build-prod
docker compose cp ac-build-prod:/azerothcore/var/ccache var/docker/
echo "ccache exported"
- name: build authserver
uses: ./.github/actions/docker-tag-and-build
with:
component-name: authserver
version: ${{ steps.version.outputs.version }}
push: ${{ github.repository == 'azerothcore/azerothcore-wotlk' && github.ref_name == 'master' }}
- name: Deploy Production images
#env:
# DOCKER_IMAGE_TAG: ${{ steps.extract_branch.outputs.branch }}
if: github.repository == 'azerothcore/azerothcore-wotlk' && steps.extract_branch.outputs.branch == 'master'
run: |
docker compose --profile prod push
output=$(./acore.sh version | grep "AzerothCore Rev. ") && version=${output#"AzerothCore Rev. "}
DOCKER_IMAGE_TAG=$version docker compose --profile prod push
- name: build db-import
uses: ./.github/actions/docker-tag-and-build
with:
component-name: db-import
version: ${{ steps.version.outputs.version }}
push: ${{ github.repository == 'azerothcore/azerothcore-wotlk' && github.ref_name == 'master' }}
- name: build client-data
uses: ./.github/actions/docker-tag-and-build
with:
component-name: client-data
version: ${{ steps.version.outputs.version }}
push: ${{ github.repository == 'azerothcore/azerothcore-wotlk' && github.ref_name == 'master' }}
- name: build tools
uses: ./.github/actions/docker-tag-and-build
with:
component-name: tools
version: ${{ steps.version.outputs.version }}
push: ${{ github.repository == 'azerothcore/azerothcore-wotlk' && github.ref_name == 'master' }}
dispatch-acore-docker:
needs: [ docker-build-n-deploy-prod , docker-build-n-deploy-dev]
runs-on: ubuntu-latest
steps:
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Repository Dispatch
if: github.repository == 'azerothcore/azerothcore-wotlk' && steps.extract_branch.outputs.branch == 'master'
if: github.repository == 'azerothcore/azerothcore-wotlk' && github.ref_name == 'master'
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.ACORE_DOCKER_REPO_ACCESS_TOKEN }}

3
.gitignore vendored
View File

@@ -24,7 +24,8 @@
/src/server/scripts/Custom/*
!/src/server/scripts/Custom/README.md
/docker-compose.override.yml
/*.override.yml
/*.override.yaml
!.gitkeep

View File

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

View 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

View File

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

View File

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

View File

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

View File

@@ -1,5 +0,0 @@
#!/usr/bin/env bash
cd /azerothcore
bash acore.sh compiler build

View File

@@ -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
View 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 "$@"

View File

@@ -1,57 +1,17 @@
version: '3.9'
# extension field: https://docs.docker.com/compose/compose-file/compose-file-v3/#extension-fields
x-networks: &networks
networks:
- ac-network
x-build-params: &build-params
context: .
dockerfile: ./apps/docker/Dockerfile
args:
USER_ID: ${DOCKER_USER_ID:-1000}
GROUP_ID: ${DOCKER_GROUP_ID:-1000}
DOCKER_USER: ${DOCKER_USER:-acore}
# BUILDKIT_INLINE_CACHE: 1
cache_from:
- acore/ac-wotlk-authserver:${DOCKER_IMAGE_TAG:-master}
- acore/ac-wotlk-authserver-local:${DOCKER_IMAGE_TAG:-master}
- acore/ac-wotlk-worldserver:${DOCKER_IMAGE_TAG:-master}
- acore/ac-wotlk-worldserver-local:${DOCKER_IMAGE_TAG:-master}
- acore/ac-wotlk-dev-server:${DOCKER_IMAGE_TAG:-master}
- acore/ac-wotlk-tools:${DOCKER_IMAGE_TAG:-master}
# Need to fix reduced space on GH actions first
# - acore/ac-wotlk-client-data:${DOCKER_IMAGE_TAG:-master}
x-ac-shared-conf: &ac-shared-conf
<<: *networks
working_dir: /azerothcore
environment:
AC_DISABLE_INTERACTIVE: "1"
x-ac-service-conf: &ac-service-conf
<<: *ac-shared-conf
# List can't be merged. See: https://forums.docker.com/t/how-to-merge-a-list-of-volumes-from-an-extension-field-into-the-service-definition/77454
# volumes:
# - ${DOCKER_VOL_ETC:-./env/dist/etc}:/azerothcore/env/dist/etc
# # [osxfs optimization]: https://stackoverflow.com/a/63437557/1964544
# - ${DOCKER_VOL_LOGS:-./env/dist/logs}:/azerothcore/env/dist/logs:delegated
# docker-compose.yml for AzerothCore.
#
# Start the server with `docker compose up -d --build`
#
# Don't make changes this file! make a `docker-compose.override.yml` and make your
# changes there instead.
version: '3'
services:
#=======================
#
# DATABASE
#
#=======================
ac-database:
<<: *networks
container_name: ac-database
image: mysql:8.0
restart: unless-stopped
cap_add:
- SYS_NICE # CAP_SYS_NICE
networks:
- ac-network
ports:
- ${DOCKER_DB_EXTERNAL_PORT:-3306}:3306
environment:
@@ -60,62 +20,154 @@ services:
- type: volume
source: ac-database
target: /var/lib/mysql
restart: unless-stopped
healthcheck:
test: "/usr/bin/mysql --user=root --password=$$MYSQL_ROOT_PASSWORD --execute \"SHOW DATABASES;\""
interval: 5s
timeout: 10s
retries: 40
#======================
#
# Dev services
#
#======================
#
# Used for the build process to avoid the host binding of the /azerothcore
# and speedup the compilation by avoiding the host-container filesystem conversion issue
# on non-ext filesystems. Reference https://stackoverflow.com/a/63437557/1964544
#
ac-dev-build:
<<: [ *ac-shared-conf ] # merge with
image: acore/ac-wotlk-dev-server:${DOCKER_IMAGE_TAG:-master}
user: ${DOCKER_USER:-root}
cap_add:
- SYS_NICE # CAP_SYS_NICE
ac-db-import:
container_name: ac-db-import
image: acore/ac-wotlk-db-import:${DOCKER_IMAGE_TAG:-master}
networks:
- ac-network
build:
target: dev
<<: *build-params
security_opt:
- seccomp:unconfined
env_file:
${DOCKER_AC_ENV_FILE:-conf/dist/env.ac}
context: .
target: db-import
dockerfile: apps/docker/Dockerfile
environment:
AC_DATA_DIR: "/azerothcore/env/dist/data"
AC_LOGS_DIR: "/azerothcore/env/dist/logs"
AC_LOGIN_DATABASE_INFO: "ac-database;3306;root;${DOCKER_DB_ROOT_PASSWORD:-password};acore_auth"
AC_WORLD_DATABASE_INFO: "ac-database;3306;root;${DOCKER_DB_ROOT_PASSWORD:-password};acore_world"
AC_CHARACTER_DATABASE_INFO: "ac-database;3306;root;${DOCKER_DB_ROOT_PASSWORD:-password};acore_characters"
volumes:
# expose some dist folder outside allowing the host to use them
- ${DOCKER_VOL_CONF:-./conf}:/azerothcore/conf
- ${DOCKER_VOL_BIN:-ac-bin-dev}:/azerothcore/env/dist/bin
- ${DOCKER_VOL_ETC:-./env/dist/etc}:/azerothcore/env/dist/etc
- ac-build-dev:/azerothcore/var/build
- ac-ccache-dev:/azerothcore/var/ccache
profiles: [dev-build]
# [osxfs optimization]: https://stackoverflow.com/a/63437557/1964544
- ${DOCKER_VOL_LOGS:-./env/dist/logs}:/azerothcore/env/dist/logs:delegated
depends_on:
ac-database:
condition: service_healthy
#
# Dev server with the ./azerothcore folder binded from the host
# Please use Linux, WSL2 or any ext-compatible filesystem
# to avoid performance issues
#
ac-dev-server:
<<: [ *ac-shared-conf ] # merge with
tty: true
image: acore/ac-wotlk-dev-server:${DOCKER_IMAGE_TAG:-master}
user: ${DOCKER_USER:-root}
cap_add:
- SYS_NICE # CAP_SYS_NICE
ac-worldserver:
container_name: ac-worldserver
image: acore/ac-wotlk-worldserver:${DOCKER_IMAGE_TAG:-master}
build:
target: dev
<<: *build-params
security_opt:
- seccomp:unconfined
context: .
target: worldserver
dockerfile: apps/docker/Dockerfile
networks:
- ac-network
stdin_open: true
tty: true
restart: unless-stopped
env_file:
${DOCKER_AC_ENV_FILE:-conf/dist/env.ac}
environment:
AC_DATA_DIR: "/azerothcore/env/dist/data"
AC_LOGS_DIR: "/azerothcore/env/dist/logs"
AC_LOGIN_DATABASE_INFO: "ac-database;3306;root;${DOCKER_DB_ROOT_PASSWORD:-password};acore_auth"
AC_WORLD_DATABASE_INFO: "ac-database;3306;root;${DOCKER_DB_ROOT_PASSWORD:-password};acore_world"
AC_CHARACTER_DATABASE_INFO: "ac-database;3306;root;${DOCKER_DB_ROOT_PASSWORD:-password};acore_characters"
ports:
- ${DOCKER_WORLD_EXTERNAL_PORT:-8085}:8085
- ${DOCKER_SOAP_EXTERNAL_PORT:-7878}:7878
volumes:
- ${DOCKER_VOL_ETC:-./env/dist/etc}:/azerothcore/env/dist/etc
# [osxfs optimization]: https://stackoverflow.com/a/63437557/1964544
- ${DOCKER_VOL_LOGS:-./env/dist/logs}:/azerothcore/env/dist/logs:delegated
# client data
- ${DOCKER_VOL_DATA:-ac-client-data}:/azerothcore/env/dist/data/:ro
depends_on:
ac-database:
condition: service_healthy
ac-db-import:
condition: service_completed_successfully
ac-client-data-init:
condition: service_completed_successfully
ac-authserver:
container_name: ac-authserver
image: acore/ac-wotlk-authserver:${DOCKER_IMAGE_TAG:-master}
build:
context: .
target: authserver
dockerfile: apps/docker/Dockerfile
networks:
- ac-network
tty: true
restart: unless-stopped
env_file:
${DOCKER_AC_ENV_FILE:-conf/dist/env.ac}
environment:
AC_LOGS_DIR: "/azerothcore/env/dist/logs"
AC_TEMP_DIR: "/azerothcore/env/dist/temp"
AC_LOGIN_DATABASE_INFO: "ac-database;3306;root;${DOCKER_DB_ROOT_PASSWORD:-password};acore_auth"
volumes:
- ${DOCKER_VOL_ETC:-./env/dist/etc}:/azerothcore/env/dist/etc
# [osxfs optimization]: https://stackoverflow.com/a/63437557/1964544
- ${DOCKER_VOL_LOGS:-./env/dist/logs}:/azerothcore/env/dist/logs:delegated
ports:
- ${DOCKER_AUTH_EXTERNAL_PORT:-3724}:3724
depends_on:
ac-database:
condition: service_healthy
ac-db-import:
condition: service_completed_successfully
ac-client-data-init:
container_name: ac-client-data-init
image: acore/ac-wotlk-client-data:${DOCKER_IMAGE_TAG:-master}
user: ${DOCKER_USER:-root}
build:
context: .
target: client-data
dockerfile: apps/docker/Dockerfile
args:
USER_ID: ${DOCKER_USER_ID:-1000}
GROUP_ID: ${DOCKER_GROUP_ID:-1000}
DOCKER_USER: ${DOCKER_USER:-acore}
volumes:
- ${DOCKER_VOL_CLIENT_DATA:-ac-client-data}:/azerothcore/env/dist/data
# used for extracting maps from files shipped with game client
# Most of the time this shouldn't be needed
ac-tools:
container_name: ac-tools
image: acore/ac-wotlk-tools:${DOCKER_IMAGE_TAG:-master}
user: ${DOCKER_USER:-root}
build:
context: .
target: tools
dockerfile: apps/docker/Dockerfile
working_dir: /azerothcore/env/client/
volumes:
# this is not the directory of the extracted data! It's the client folder used by the extractors
- ${DOCKER_AC_CLIENT_FOLDER:-./var/client}:/azerothcore/env/dist/bin/Data
# Activate with `docker compose --profile tools ...`
profiles: [tools]
# Dev server with the ./azerothcore folder binded from the host
# Please use Linux, WSL2 or any ext-compatible filesystem
# to avoid performance issues
#
# This is primarily intended for use with the "devcontainer" project
#
# This is provided primarily for development, though it doesn't receive
# first-class support
ac-dev-server:
tty: true
image: acore/ac-wotlk-dev-server:${DOCKER_IMAGE_TAG:-master}
user: ${DOCKER_USER:-root}
build:
context: .
dockerfile: ./apps/docker/Dockerfile.dev-server
args:
USER_ID: ${DOCKER_USER_ID:-1000}
GROUP_ID: ${DOCKER_GROUP_ID:-1000}
DOCKER_USER: ${DOCKER_USER:-acore}
target: dev
env_file:
${DOCKER_AC_ENV_FILE:-conf/dist/env.ac}
environment:
@@ -124,7 +176,6 @@ services:
AC_LOGIN_DATABASE_INFO: "ac-database;3306;root;${DOCKER_DB_ROOT_PASSWORD:-password};acore_auth"
AC_WORLD_DATABASE_INFO: "ac-database;3306;root;${DOCKER_DB_ROOT_PASSWORD:-password};acore_world"
AC_CHARACTER_DATABASE_INFO: "ac-database;3306;root;${DOCKER_DB_ROOT_PASSWORD:-password};acore_characters"
AC_CLOSE_IDLE_CONNECTIONS: "0"
ports:
- ${DOCKER_AUTH_EXTERNAL_PORT:-3724}:3724
- ${DOCKER_WORLD_EXTERNAL_PORT:-8085}:8085
@@ -136,285 +187,18 @@ services:
- ac-ccache-dev:/azerothcore/var/ccache
# this is not the directory of the extracted data! It's the client folder used by the extractors
- ${DOCKER_AC_CLIENT_FOLDER:-./var/client}:/azerothcore/env/dist/bin/Data
# Activate with `docker compose --profile dev ...`
profiles: [dev]
depends_on:
ac-database:
condition: service_healthy
ac-db-import:
<<: *ac-shared-conf
image: acore/ac-wotlk-worldserver-local:${DOCKER_IMAGE_TAG:-master} # name of the generated image after built locally
command: ./env/dist/bin/dbimport
environment:
AC_DATA_DIR: "/azerothcore/env/dist/data"
AC_LOGS_DIR: "/azerothcore/env/dist/logs"
AC_LOGIN_DATABASE_INFO: "ac-database;3306;root;${DOCKER_DB_ROOT_PASSWORD:-password};acore_auth"
AC_WORLD_DATABASE_INFO: "ac-database;3306;root;${DOCKER_DB_ROOT_PASSWORD:-password};acore_world"
AC_CHARACTER_DATABASE_INFO: "ac-database;3306;root;${DOCKER_DB_ROOT_PASSWORD:-password};acore_characters"
AC_CLOSE_IDLE_CONNECTIONS: "0"
volumes:
# read-only binaries compiled by ac-dev-server
- ${DOCKER_VOL_BIN:-ac-bin-dev}:/azerothcore/env/dist/bin:ro
- ${DOCKER_VOL_ETC:-./env/dist/etc}:/azerothcore/env/dist/etc:ro
# [osxfs optimization]: https://stackoverflow.com/a/63437557/1964544
- ${DOCKER_VOL_LOGS:-./env/dist/logs}:/azerothcore/env/dist/logs:delegated
profiles: [local, app, db-import-local]
depends_on:
ac-database:
condition: service_healthy
#=======================
#
# APP Services
#
#=======================
ac-worldserver:
<<: *ac-service-conf # merge with ac-service-conf
stdin_open: true
tty: true
cap_add:
- SYS_NICE # CAP_SYS_NICE
command: ./acore.sh run-worldserver
image: acore/ac-wotlk-worldserver-local:${DOCKER_IMAGE_TAG:-master} # name of the generated image after built locally
restart: unless-stopped
env_file:
${DOCKER_AC_ENV_FILE:-conf/dist/env.ac}
environment:
AC_DATA_DIR: "/azerothcore/env/dist/data"
AC_LOGS_DIR: "/azerothcore/env/dist/logs"
AC_LOGIN_DATABASE_INFO: "ac-database;3306;root;${DOCKER_DB_ROOT_PASSWORD:-password};acore_auth"
AC_WORLD_DATABASE_INFO: "ac-database;3306;root;${DOCKER_DB_ROOT_PASSWORD:-password};acore_world"
AC_CHARACTER_DATABASE_INFO: "ac-database;3306;root;${DOCKER_DB_ROOT_PASSWORD:-password};acore_characters"
AC_CLOSE_IDLE_CONNECTIONS: "0"
user: ${DOCKER_USER:-root}
privileged: true
build:
target: worldserver-local
<<: *build-params
ports:
- ${DOCKER_WORLD_EXTERNAL_PORT:-8085}:8085
- ${DOCKER_SOAP_EXTERNAL_PORT:-7878}:7878
volumes:
# read-only binaries compiled by ac-dev-server
- ${DOCKER_VOL_BIN:-ac-bin-dev}:/azerothcore/env/dist/bin:ro
- ${DOCKER_VOL_ETC:-./env/dist/etc}:/azerothcore/env/dist/etc:ro
# [osxfs optimization]: https://stackoverflow.com/a/63437557/1964544
- ${DOCKER_VOL_LOGS:-./env/dist/logs}:/azerothcore/env/dist/logs:delegated
# client data
- ${DOCKER_VOL_DATA:-./env/dist/data/}:/azerothcore/env/dist/data/
profiles: [local, app, worldserver]
depends_on:
ac-database:
condition: service_healthy
ac-db-import:
condition: service_completed_successfully
ac-authserver:
<<: *ac-service-conf # merge with ac-service-conf
tty: true
command: ./acore.sh run-authserver
image: acore/ac-wotlk-authserver-local:${DOCKER_IMAGE_TAG:-master} # name of the generated image after built locally
restart: unless-stopped
env_file:
${DOCKER_AC_ENV_FILE:-conf/dist/env.ac}
environment:
AC_LOGS_DIR: "/azerothcore/env/dist/logs"
AC_TEMP_DIR: "/azerothcore/env/dist/temp"
AC_LOGIN_DATABASE_INFO: "ac-database;3306;root;${DOCKER_DB_ROOT_PASSWORD:-password};acore_auth"
AC_SQLDRIVER_LOG_FILE: "SQLDriver.log"
AC_SQLDRIVER_QUERY_LOGGING: "1"
user: ${DOCKER_USER:-root}
build:
target: authserver-local
<<: *build-params
volumes:
# read-only binaries compiled by ac-dev-server
- ${DOCKER_VOL_BIN:-ac-bin-dev}:/azerothcore/env/dist/bin:ro
- ${DOCKER_VOL_ETC:-./env/dist/etc}:/azerothcore/env/dist/etc
# [osxfs optimization]: https://stackoverflow.com/a/63437557/1964544
- ${DOCKER_VOL_LOGS:-./env/dist/logs}:/azerothcore/env/dist/logs:delegated
ports:
- ${DOCKER_AUTH_EXTERNAL_PORT:-3724}:3724
profiles: [local, app, authserver]
depends_on:
ac-database:
condition: service_healthy
ac-db-import:
condition: service_completed_successfully
#======================
#
# Production services
#
# The following services are used to test the production images
# Do not use them unless you know what you're doing!
# We do not offer support for them
#
# For a production-ready docker-compose, please check the official repo: https://github.com/azerothcore/acore-docker
#
#======================
ac-database-prod:
<<: *networks
image: mysql:8.0
restart: unless-stopped
cap_add:
- SYS_NICE # CAP_SYS_NICE
ports:
- ${DOCKER_DB_EXTERNAL_PORT:-3306}:3306
environment:
- MYSQL_ROOT_PASSWORD=${DOCKER_DB_ROOT_PASSWORD:-password}
volumes:
- type: volume
source: ac-database-prod
target: /var/lib/mysql
healthcheck:
test: "/usr/bin/mysql --user=root --password=$$MYSQL_ROOT_PASSWORD --execute \"SHOW DATABASES;\""
interval: 5s
timeout: 10s
retries: 40
profiles: [prod]
ac-worldserver-prod:
<<: *ac-service-conf # merge with ac-service-conf
stdin_open: true
tty: true
cap_add:
- SYS_NICE # CAP_SYS_NICE
command: ./acore.sh run-worldserver
image: acore/ac-wotlk-worldserver:${DOCKER_IMAGE_TAG:-master} # name of the generated image after built locally
restart: unless-stopped
env_file:
${DOCKER_AC_ENV_FILE:-conf/dist/env.ac}
environment:
AC_DATA_DIR: "/azerothcore/env/dist/data"
AC_LOGS_DIR: "/azerothcore/env/dist/logs"
AC_LOGIN_DATABASE_INFO: "ac-database;3306;root;${DOCKER_DB_ROOT_PASSWORD:-password};acore_auth"
AC_WORLD_DATABASE_INFO: "ac-database;3306;root;${DOCKER_DB_ROOT_PASSWORD:-password};acore_world"
AC_CHARACTER_DATABASE_INFO: "ac-database;3306;root;${DOCKER_DB_ROOT_PASSWORD:-password};acore_characters"
AC_CLOSE_IDLE_CONNECTIONS: "0"
user: ${DOCKER_USER:-root}
privileged: true
build:
target: worldserver
<<: *build-params
ports:
- ${DOCKER_WORLD_EXTERNAL_PORT:-8085}:8085
- ${DOCKER_SOAP_EXTERNAL_PORT:-7878}:7878
volumes:
- ${DOCKER_VOL_LOGS:-./env/dist/logs}:/azerothcore/env/dist/logs:delegated
- ${DOCKER_VOL_CLIENT_DATA_PROD:-ac-client-data-prod}:/azerothcore/env/dist/data:ro
profiles: [prod, prod-app, prod-worldserver]
depends_on:
ac-database-prod:
condition: service_healthy
ac-db-import-prod:
condition: service_completed_successfully
ac-client-data-init:
condition: service_started
ac-authserver-prod:
<<: *ac-service-conf # merge with ac-service-conf
tty: true
command: ./acore.sh run-authserver
image: acore/ac-wotlk-authserver:${DOCKER_IMAGE_TAG:-master} # name of the generated image after built locally
restart: unless-stopped
env_file:
${DOCKER_AC_ENV_FILE:-conf/dist/env.ac}
environment:
AC_LOGS_DIR: "/azerothcore/env/dist/logs"
AC_TEMP_DIR: "/azerothcore/env/dist/temp"
AC_LOGIN_DATABASE_INFO: "ac-database;3306;root;${DOCKER_DB_ROOT_PASSWORD:-password};acore_auth"
AC_SQLDRIVER_LOG_FILE: "SQLDriver.log"
AC_SQLDRIVER_QUERY_LOGGING: "1"
user: ${DOCKER_USER:-root}
build:
target: authserver
<<: *build-params
volumes:
- ${DOCKER_VOL_LOGS:-./env/dist/logs}:/azerothcore/env/dist/logs:delegated
ports:
- ${DOCKER_AUTH_EXTERNAL_PORT:-3724}:3724
profiles: [prod, prod-app, prod-authserver]
depends_on:
ac-database-prod:
condition: service_healthy
ac-db-import-prod:
condition: service_completed_successfully
ac-client-data-init:
image: acore/ac-wotlk-client-data:${DOCKER_IMAGE_TAG:-master} # name of the generated image after built locally
user: ${DOCKER_USER:-root}
build:
target: client-data
<<: *build-params
args:
USER_ID: ${DOCKER_USER_ID:-1000}
GROUP_ID: ${DOCKER_GROUP_ID:-1000}
DOCKER_USER: ${DOCKER_USER:-acore}
# BUILDKIT_INLINE_CACHE: 1
volumes:
- ${DOCKER_VOL_CLIENT_DATA_PROD:-ac-client-data-prod}:/azerothcore/env/dist/data:ro
profiles: [prod, prod-app, clientdata]
ac-tools:
image: acore/ac-wotlk-tools:${DOCKER_IMAGE_TAG:-master} # name of the generated image after built locally
user: ${DOCKER_USER:-root}
build:
target: tools
<<: *build-params
working_dir: /azerothcore/env/client/
volumes:
# this is not the directory of the extracted data! It's the client folder used by the extractors
- ${DOCKER_AC_CLIENT_FOLDER:-./var/client}:/azerothcore/env/dist/bin/Data
profiles: [prod, tools]
ac-db-import-prod:
<<: *ac-shared-conf
image: acore/ac-wotlk-worldserver:${DOCKER_IMAGE_TAG:-master} # name of the generated image after built locally
command: ./env/dist/bin/dbimport
environment:
AC_DATA_DIR: "/azerothcore/env/dist/data"
AC_LOGS_DIR: "/azerothcore/env/dist/logs"
AC_LOGIN_DATABASE_INFO: "ac-database;3306;root;${DOCKER_DB_ROOT_PASSWORD:-password};acore_auth"
AC_WORLD_DATABASE_INFO: "ac-database;3306;root;${DOCKER_DB_ROOT_PASSWORD:-password};acore_world"
AC_CHARACTER_DATABASE_INFO: "ac-database;3306;root;${DOCKER_DB_ROOT_PASSWORD:-password};acore_characters"
AC_CLOSE_IDLE_CONNECTIONS: "0"
profiles: [prod, prod-app, db-import-prod]
#
# Only for internal tests
#
ac-build-prod:
<<: *ac-shared-conf
build:
target: build
<<: *build-params
env_file:
${DOCKER_AC_ENV_FILE:-conf/dist/env.ac}
working_dir: /azerothcore/
profiles: [prod-build]
volumes:
ac-database:
ac-database-prod:
ac-bin-dev:
ac-client-data:
# Used for dev server
ac-build-dev:
ac-ccache-dev:
ac-proj:
ac-client-data-prod:
# not used, but you can use them by setting
# the DOCKER_VOL_* env variabiles
ac-root:
ac-conf:
ac-etc:
ac-logs:
ac-client-data-cameras:
ac-client-data-dbc:
ac-client-data-maps:
ac-client-data-vmaps:
ac-client-data-mmaps:
networks:
ac-network: