summaryrefslogtreecommitdiff
path: root/docker-compose.yml
blob: 16ade324fd69ed80cf650ed2dc5c1ee8dcf4c61a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
version: '3.9'

# extension field: https://docs.docker.com/compose/compose-file/compose-file-v3/#extension-fields
x-networks: &networks
  networks:
    - ac-network

x-ac-shared-conf: &ac-shared-conf
  <<: *networks
  working_dir: /azerothcore
  depends_on:
    ac-database:
      condition: service_healthy

services:
#============================
#
# Abstract services to extend
#
#============================

  abstract-bind:
    image: local/azerothcore/abstract-bind
    volumes:
      - .:/azerothcore/
      # env dir shared between services
      # we cannot use /env/dist to avoid permission issues
      - ac-env:/azerothcore/env
      # expose some dist folder outside allowing the host to use them
      - ${DOCKER_CONF:-./conf}:/azerothcore/conf
      - ${DOCKER_ETC:-./env/docker/etc}:/azerothcore/env/dist/etc
      # [osxfs optimization]: https://stackoverflow.com/a/63437557/1964544
      - ${DOCKER_LOGS:-./env/docker/logs}:/azerothcore/env/dist/logs:delegated
      - ${DOCKER_DATA:-./env/docker/data}:/azerothcore/env/dist/data:delegated
    profiles: [abstract-service] # do not run this

  abstract-no-bind:
    image: local/azerothcore/abstract-no-bind
    volumes:
      - ac-proj:/azerothcore/
    profiles: [abstract-service] # do not run this

#=======================
#
# Applications
#
#=======================


  ac-database:
    <<: *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
        target: /var/lib/mysql
    healthcheck:
      test: "/usr/bin/mysql --user=root --password=$$MYSQL_ROOT_PASSWORD --execute \"SHOW DATABASES;\""
      interval: 2s
      timeout: 20s
      retries: 10


  ac-worldserver:
    <<: *ac-shared-conf
    extends: ${DOCKER_EXTENDS_BIND:-abstract-bind}
    stdin_open: true
    tty: true
    command: ./acore.sh run-worldserver
    image: acore/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}
    privileged: true
    build:
      context: .
      target: ${DOCKER_BUILD_WORLD_TARGET:-dev}
      dockerfile: ./apps/docker/Dockerfile
    ports:
      - ${DOCKER_WORLD_EXTERNAL_PORT:-8085}:8085
      - ${DOCKER_SOAP_EXTERNAL_PORT:-7878}:7878
    profiles: [all, app, worldserver]

  ac-authserver:
    <<: *ac-shared-conf
    extends: ${DOCKER_EXTENDS_BIND:-abstract-bind}
    tty: true
    command: ./acore.sh run-authserver
    image: acore/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}
    build:
      context: .
      target: ${DOCKER_BUILD_AUTH_TARGET:-dev}
      dockerfile: ./apps/docker/Dockerfile
    ports:
      - ${DOCKER_AUTH_EXTERNAL_PORT:-3724}:3724
    profiles: [all, app, authserver]

#======================
#
# Dev services
#
#======================

  ac-dev-server:
    <<: *ac-shared-conf
    tty: true
    image: acore/dev-server:${DOCKER_IMAGE_TAG:-master}
    security_opt:
      - seccomp:unconfined
    build:
      context: .
      target: dev
      dockerfile: ./apps/docker/Dockerfile
      args:
        USER_ID: ${DOCKER_USER_ID:-1000}
        GROUP_ID: ${DOCKER_GROUP_ID:-1000}
    extends: ${DOCKER_EXTENDS_BIND:-abstract-bind}
    env_file:
        ${DOCKER_AC_ENV_FILE:-conf/dist/env.ac}
    environment:
        DBLIST: AUTH,CHARACTERS,WORLD
    ports:
      - ${DOCKER_AUTH_EXTERNAL_PORT:-3724}:3724
      - ${DOCKER_WORLD_EXTERNAL_PORT:-8085}:8085
      - ${DOCKER_SOAP_EXTERNAL_PORT:-7878}:7878
    volumes:
      - ac-build:/azerothcore/var/build
    profiles: [all, dev]

volumes:
  ac-database:
  ac-env:
  ac-build:
  ac-proj:

networks:
  ac-network: