From dc6289965013827328ce86683eadcf36a015c0b3 Mon Sep 17 00:00:00 2001 From: BlitzW! Date: Tue, 1 Sep 2026 20:07:13 +0200 Subject: [PATCH 1/4] chore: normalise les fins de ligne via .gitattributes Le depot melangeait CRLF et LF, ce qui produisait en permanence un diff de 274 fichiers / 36754 insertions / 36754 suppressions de pur bruit. *.sh est force en LF : un script en CRLF donne "/bin/bash^M: bad interpreter" dans le conteneur. Les binaires (.bin, .lex, .jar, .exe, .ser) sont exclus de toute conversion. Co-Authored-By: Claude Opus 5 (1M context) --- .gitattributes | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..d593366 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,13 @@ +* text=auto eol=lf + +*.sh text eol=lf +*.bat text eol=crlf + +*.bin binary +*.lex binary +*.jar binary +*.exe binary +*.png binary +*.jpg binary +*.ico binary +*.ser binary From 57c585a1f8d3a2e5bbffa3c5800d7bf9c9243c3d Mon Sep 17 00:00:00 2001 From: BlitzW! Date: Tue, 1 Sep 2026 20:07:35 +0200 Subject: [PATCH 2/4] deps: epingle websockets 13.1 et passe PHP en 8.3 websockets n'etait pas epingle. Le code utilise l'API legacy (websockets.server.serve, .path, .open), supprimee en 14.0 : le prochain pip install cassait le serveur de jeu. 13.1 est la derniere version compatible sans modification du code. PHP 8.2 n'a plus que du support securite jusqu'au 31/12/2026. Co-Authored-By: Claude Opus 5 (1M context) --- Game/server/README.md | 2 +- Game/server/requirements.txt | 2 +- README.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Game/server/README.md b/Game/server/README.md index 35702e0..8828aa2 100644 --- a/Game/server/README.md +++ b/Game/server/README.md @@ -37,7 +37,7 @@ pip install -r requirements.txt Si vous n'avez pas de fichier `requirements.txt`, vous pouvez installer le module websockets manuellement : ```bash -pip install websockets +pip install websockets==13.1 ``` ## Utilisation diff --git a/Game/server/requirements.txt b/Game/server/requirements.txt index 7a38911..4b08a6b 100644 --- a/Game/server/requirements.txt +++ b/Game/server/requirements.txt @@ -1 +1 @@ -websockets \ No newline at end of file +websockets==13.1 diff --git a/README.md b/README.md index 176d4b5..04e4a90 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Technolgie | Version | Partie associée | Node.js | ``20.12`` | Site react NPM | ``10.5`` | Site react Composer | ``2.7`` | API PHP -PHP | ``8.2`` | API PHP +PHP | ``8.3`` | API PHP Java | ``19`` | Moteur de jeu Python | ``3.12`` | Serveur jeu multijoueur From 907d489dcde7f6a63c53fde871c94ca87b3588d3 Mon Sep 17 00:00:00 2001 From: BlitzW! Date: Tue, 1 Sep 2026 20:07:37 +0200 Subject: [PATCH 3/4] build: image autonome multi-stage, sans bind mount L'application est desormais embarquee dans l'image au lieu d'arriver par le montage /docker/linksawordkening/data/. Le deploiement devient build + up, versionnable et reversible. Etages : Python 3.12.14, front React, deps Composer, binaires C, JRE jlink (jdeps -> java.base seul). Aplatissement final via FROM scratch, sans lequel les 250 Mo de chaine de compilation de la base php:apache resteraient dans l'image malgre la purge : 1,9 Go -> 665 Mo. Deux services au lieu d'un : un gel du serveur de jeu ne fait plus tomber le site. init.sh est remplace par le CMD natif pour web et par game-server.sh (watchdog) pour game. Secrets via getenv() + PassEnv, plus aucun fichier sur disque. configuration.php echoue immediatement si une variable manque. Corrections au passage : locale-gen jamais lance, base non tagee (php:apache pointait deja sur 8.4), mod_rewrite inactif alors que les deux .htaccess en dependent, php.ini absent (l'image officielle n'en active aucun), opcache non installe, Data/ copie en data/ minuscule comme l'attendent les include PHP. Co-Authored-By: Claude Opus 5 (1M context) --- .dockerignore | 35 +++++ .gitignore | 4 +- devops_config/compose.yaml | 65 +++++++-- devops_config/configuration.docker.php | 33 +++++ devops_config/dockerimage.dockerfile | 194 +++++++++++++++++++++---- devops_config/env.example | 17 +++ devops_config/game-server.sh | 30 ++++ devops_config/init.sh | 5 - 8 files changed, 338 insertions(+), 45 deletions(-) create mode 100644 .dockerignore create mode 100644 devops_config/configuration.docker.php create mode 100644 devops_config/env.example create mode 100644 devops_config/game-server.sh delete mode 100644 devops_config/init.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..0cda54b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,35 @@ +.git +.gitignore +.gitattributes +.remember/ +.dockerignore + +Game/C/datafiles/*.txt +Game/C/executables/*.exe + +Game/Java/.metadata/ +Game/Java/.settings/ +Game/Java/.classpath +Game/Java/.project +Game/Java/target/classes/ +Game/Java/target/maven-archiver/ +Game/Java/target/maven-status/ + +frontend/node_modules/ +frontend/build/ + +api/vendor/ + +configuration.php +configuration.ini +config.ini +frontend/config.env +frontend/.env* +devops_config/.env + +**/.vscode/ +**/.idea/ +**/__pycache__/ +Game/server/env-py/ +documents/ +*.md diff --git a/.gitignore b/.gitignore index bf3812b..02c398d 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,6 @@ Game/server/env-py/ Game/server/data/__pycache__ Game/server/classes/__pycache__ api/vendor -documents/reporting \ No newline at end of file +documents/reporting +devops_config/.env +devops_config/demo.env diff --git a/devops_config/compose.yaml b/devops_config/compose.yaml index 8cdab1a..1cf0eca 100644 --- a/devops_config/compose.yaml +++ b/devops_config/compose.yaml @@ -1,20 +1,61 @@ -# Ici ça compose -# PAS TOUCHER -# C'est pour le déploiement de l'application -# 02/02/2024 - Pour PVE +x-app: &app + image: linksawordkening:latest + build: + context: .. + dockerfile: devops_config/dockerimage.dockerfile + args: + REACT_APP_API_URL: ${APP_API_URL} + REACT_APP_WS_URL: ${APP_WS_URL} + WS_PATH: ${WS_PATH:-/game} + restart: 'unless-stopped' + init: true + security_opt: + - no-new-privileges:true services: web: - image: linksawordkening:latest - entrypoint: bash /var/www/html/init.sh + <<: *app + environment: + DB_HOST: ${DB_HOST:?} + DB_NAME: ${DB_NAME:?} + DB_USER: ${DB_USER:?} + DB_PASS: ${DB_PASS:?} + JWT_SECRET: ${JWT_SECRET:?} + JWT_DOMAIN: ${JWT_DOMAIN:?} + MAIL_ADDRESS: ${MAIL_ADDRESS:-} + MAIL_PASSWORD: ${MAIL_PASSWORD:-} + APP_HOST: ${APP_HOST:?} + APP_API_URL: ${APP_API_URL:?} + ports: + - "${WEB_PORT:?WEB_PORT manquant dans devops_config/.env}:80" + deploy: + resources: + limits: + cpus: "2.0" + memory: 384M + pids: 512 + healthcheck: + test: ["CMD-SHELL", "curl -fsS --max-time 5 -o /dev/null http://127.0.0.1/"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 20s + + game: + <<: *app + command: /usr/local/bin/game-server.sh ports: - - "xxxx:80" - "8765:8765" - volumes: - - lechemin:/var/www/html - restart: 'unless-stopped' + stop_grace_period: 30s deploy: resources: limits: - cpus: "4.0" - memory: 512M \ No newline at end of file + cpus: "2.0" + memory: 768M + pids: 512 + healthcheck: + test: ["CMD-SHELL", "curl -sS --max-time 5 -o /dev/null http://127.0.0.1:8765/; rc=$$?; [ $$rc -ne 28 ] && [ $$rc -ne 7 ]"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 20s diff --git a/devops_config/configuration.docker.php b/devops_config/configuration.docker.php new file mode 100644 index 0000000..a3712e7 --- /dev/null +++ b/devops_config/configuration.docker.php @@ -0,0 +1,33 @@ + getenv($v) === false || getenv($v) === ''); + +if ($missing !== []) { + http_response_code(500); + exit('Configuration incomplete: ' . implode(', ', $missing)); +} + +$config = [ + 'database' => [ + 'host' => getenv('DB_HOST'), + 'db' => getenv('DB_NAME'), + 'login' => getenv('DB_USER'), + 'password' => getenv('DB_PASS'), + ], + + 'PHPMailer' => [ + 'mailadress' => getenv('MAIL_ADDRESS'), + 'mailpassword' => getenv('MAIL_PASSWORD'), + ], + + 'links' => [ + 'host' => getenv('APP_HOST'), + 'apiURL' => getenv('APP_API_URL'), + ], + + 'JWT' => [ + 'secretKey' => getenv('JWT_SECRET'), + 'domainName' => getenv('JWT_DOMAIN'), + ], +]; diff --git a/devops_config/dockerimage.dockerfile b/devops_config/dockerimage.dockerfile index c0d1ad2..28021bb 100644 --- a/devops_config/dockerimage.dockerfile +++ b/devops_config/dockerimage.dockerfile @@ -1,38 +1,178 @@ -#Version2.3 -#BlitzWoof! -#awooo.fr +FROM php:8.3-apache-bookworm AS python-builder -FROM php:apache +ARG PYTHON_VERSION=3.12.14 +ARG WEBSOCKETS_VERSION=13.1 -RUN apt-get update && apt-get install -y openjdk-17-jre -RUN docker-php-ext-install pdo_mysql +WORKDIR /usr/src -RUN apt-get -y install locales -ENV LANG fr_FR.UTF-8 -ENV LC_ALL fr_FR.UTF-8 +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential wget ca-certificates \ + zlib1g-dev libncurses-dev libgdbm-dev libssl-dev \ + libreadline-dev libffi-dev libsqlite3-dev libbz2-dev \ + && wget -q "https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz" \ + && tar xf "Python-${PYTHON_VERSION}.tgz" \ + && cd "Python-${PYTHON_VERSION}" \ + && ./configure --prefix=/opt/python --with-ensurepip=install \ + && make -j "$(nproc)" \ + && make install \ + && cd /usr/src && rm -rf "/usr/src/Python-${PYTHON_VERSION}"* \ + && /opt/python/bin/python3 -m pip install --no-cache-dir --upgrade pip \ + && /opt/python/bin/python3 -m pip install --no-cache-dir "websockets==${WEBSOCKETS_VERSION}" \ + && /opt/python/bin/python3 -m pip uninstall -y pip setuptools \ + && rm -rf /opt/python/lib/python3.12/config-3.12-* \ + /opt/python/lib/python3.12/idlelib \ + /opt/python/lib/python3.12/ensurepip \ + /opt/python/lib/python3.12/turtledemo \ + /opt/python/lib/python3.12/tkinter \ + && find /opt/python -name '*.a' -delete \ + && find /opt/python -name '__pycache__' -type d -prune -exec rm -rf {} + \ + && find /opt/python -name 'test' -type d -prune -exec rm -rf {} + -RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - -RUN apt-get install -y nodejs -RUN npm install -g npm@10.4.0 -RUN apt-get update && apt-get install -y build-essential wget zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev +FROM node:20-bookworm-slim AS front-builder -WORKDIR /usr/src -RUN wget https://www.python.org/ftp/python/3.12.3/Python-3.12.3.tgz -RUN tar xvf Python-3.12.3.tgz -WORKDIR /usr/src/Python-3.12.3 -RUN ./configure --enable-optimizations -RUN make -j $(nproc) -RUN make install +ARG REACT_APP_API_URL +ARG REACT_APP_WS_URL +ENV REACT_APP_API_URL=${REACT_APP_API_URL} \ + REACT_APP_WS_URL=${REACT_APP_WS_URL} \ + CI=false \ + GENERATE_SOURCEMAP=false -WORKDIR /usr/src -RUN rm -rf Python-3.12.3 Python-3.12.3.tgz -RUN apt-get purge -y build-essential wget -RUN apt-get autoremove -y +WORKDIR /src +COPY frontend/package.json frontend/package-lock.json ./ +RUN npm ci +COPY frontend/ ./ +RUN npx react-scripts build + + +FROM composer:2 AS php-deps + +WORKDIR /src +COPY api/composer.json api/composer.lock ./ +RUN composer install --no-dev --no-scripts --no-interaction --optimize-autoloader + + +FROM debian:bookworm-slim AS c-builder + +RUN apt-get update && apt-get install -y --no-install-recommends gcc libc6-dev \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /src +COPY Game/C/headers/ ./headers/ +COPY Game/C/sourcefiles/ ./sourcefiles/ +RUN mkdir -p /out \ + && gcc -O2 ./sourcefiles/new_game.c ./sourcefiles/functions.c -I./headers -lm -o /out/new_game \ + && gcc -O2 ./sourcefiles/add_word.c ./sourcefiles/functions.c -I./headers -lm -o /out/add_word + + +FROM debian:bookworm-slim AS jre-builder + +RUN apt-get update && apt-get install -y --no-install-recommends openjdk-17-jdk-headless binutils \ + && rm -rf /var/lib/apt/lists/* + +COPY Game/Java/target/ChainEngine-3.0.jar /tmp/app.jar +RUN MODULES="$(jdeps --print-module-deps --ignore-missing-deps /tmp/app.jar)" \ + && echo "modules: ${MODULES}" \ + && jlink --add-modules "${MODULES}" --strip-debug --no-header-files --no-man-pages \ + --compress=2 --output /opt/jre \ + && /opt/jre/bin/java --version + + +FROM php:8.3-apache-bookworm AS runtime + +RUN docker-php-ext-install pdo_mysql opcache \ + && mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \ + && printf '%s\n' \ + 'expose_php=Off' \ + 'opcache.enable=1' \ + 'opcache.memory_consumption=128' \ + 'opcache.max_accelerated_files=10000' \ + 'opcache.validate_timestamps=0' \ + > "$PHP_INI_DIR/conf.d/z-app.ini" + +RUN apt-get update && apt-get install -y --no-install-recommends \ + ca-certificates curl locales \ + libssl3 libffi8 libsqlite3-0 libbz2-1.0 libreadline8 libncursesw6 libgdbm6 \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +RUN sed -i 's/^# *\(fr_FR.UTF-8\)/\1/' /etc/locale.gen \ + && locale-gen +ENV LANG=fr_FR.UTF-8 \ + LANGUAGE=fr_FR:fr \ + LC_ALL=fr_FR.UTF-8 + +COPY --from=python-builder /opt/python /opt/python +COPY --from=jre-builder /opt/jre /opt/jre +ENV PATH="/opt/python/bin:/opt/jre/bin:${PATH}" \ + PYTHONUNBUFFERED=1 \ + JAVA_TOOL_OPTIONS="-XX:TieredStopAtLevel=1 -XX:+UseSerialGC -Xms16m -Xmx128m" +RUN a2enmod rewrite headers \ + && printf '%s\n' \ + '' \ + ' AllowOverride All' \ + ' Require all granted' \ + '' \ + 'PassEnv DB_HOST DB_NAME DB_USER DB_PASS' \ + 'PassEnv JWT_SECRET JWT_DOMAIN' \ + 'PassEnv MAIL_ADDRESS MAIL_PASSWORD' \ + 'PassEnv APP_HOST APP_API_URL' \ + 'ServerTokens Prod' \ + 'ServerSignature Off' \ + 'TraceEnable Off' \ + > /etc/apache2/conf-available/z-app.conf \ + && a2enconf z-app WORKDIR /var/www/html -EXPOSE 80 +COPY --from=front-builder /src/build/ /var/www/html/ +COPY --from=php-deps /src/vendor/ /var/www/html/api/vendor/ +COPY --from=c-builder /out/ /var/www/html/Game/C/executables/ +COPY api/ /var/www/html/api/ +COPY Data/ /var/www/html/data/ +COPY Game/server/ /var/www/html/Game/server/ +COPY Game/Java/target/ChainEngine-3.0.jar /var/www/html/Game/Java/target/ +COPY Game/C/datafiles/dic.lex Game/C/datafiles/words.bin /var/www/html/Game/C/datafiles/ +COPY devops_config/.htaccess /var/www/html/.htaccess +COPY devops_config/configuration.docker.php /var/www/html/configuration.php +COPY --chmod=755 devops_config/game-server.sh /usr/local/bin/game-server.sh + +ARG WS_BIND_HOST=0.0.0.0 +ARG WS_PATH=/game +RUN grep -q 'WebsocketServer("localhost", 8765)' Game/server/main.py \ + && sed -i "s|WebsocketServer(\"localhost\", 8765)|WebsocketServer(\"${WS_BIND_HOST}\", 8765)|" Game/server/main.py \ + && grep -q 'websocket.path == "/game"' Game/server/classes/client.py \ + && sed -i "s|websocket.path == \"/game\"|websocket.path == \"${WS_PATH}\"|" Game/server/classes/client.py \ + && mkdir -p Game/Java/src/files/input Game/Java/src/files/output Game/Java/src/files/save -#for docker setup only -#elboyo built-for \ No newline at end of file +RUN find /usr/local /opt/python /opt/jre -type f -executable -exec ldd '{}' ';' 2>/dev/null \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) next; if (index(so, "/opt/") == 1) next; print so }' \ + | sort -u \ + | xargs -r dpkg-query --search 2>/dev/null \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + && apt-get purge -y --auto-remove $PHPIZE_DEPS binutils libc6-dev linux-libc-dev \ + && rm -rf /var/lib/apt/lists/* /var/cache/apt/* \ + /usr/share/doc/* /usr/share/man/* /usr/share/info/* \ + /usr/share/i18n /usr/include + + +FROM scratch + +COPY --from=runtime / / + +ENV PATH="/opt/python/bin:/opt/jre/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \ + PHP_INI_DIR=/usr/local/etc/php \ + APACHE_CONFDIR=/etc/apache2 \ + APACHE_ENVVARS=/etc/apache2/envvars \ + LANG=fr_FR.UTF-8 \ + LANGUAGE=fr_FR:fr \ + LC_ALL=fr_FR.UTF-8 \ + PYTHONUNBUFFERED=1 \ + JAVA_TOOL_OPTIONS="-XX:TieredStopAtLevel=1 -XX:+UseSerialGC -Xms16m -Xmx128m" + +WORKDIR /var/www/html +STOPSIGNAL SIGWINCH +EXPOSE 80 8765 +ENTRYPOINT ["docker-php-entrypoint"] +CMD ["apache2-foreground"] diff --git a/devops_config/env.example b/devops_config/env.example new file mode 100644 index 0000000..ae98a36 --- /dev/null +++ b/devops_config/env.example @@ -0,0 +1,17 @@ +WEB_PORT=8080 + +DB_HOST= +DB_NAME= +DB_USER= +DB_PASS= + +JWT_SECRET= +JWT_DOMAIN= + +MAIL_ADDRESS= +MAIL_PASSWORD= + +APP_HOST=https://linksawordkening.example.tf/ +APP_API_URL=https://linksawordkening.example.tf/api/ +APP_WS_URL=wss://linksawordkening.example.tf/ws/game +WS_PATH=/game diff --git a/devops_config/game-server.sh b/devops_config/game-server.sh new file mode 100644 index 0000000..7714ef6 --- /dev/null +++ b/devops_config/game-server.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +set -uo pipefail + +WS_PORT="${WS_PORT:-8765}" +CHECK_INTERVAL="${CHECK_INTERVAL:-15}" +MAX_FAILURES="${MAX_FAILURES:-3}" + +cd /var/www/html/Game/server || exit 1 + +python3 main.py & +PY_PID=$! +trap 'kill -TERM "${PY_PID}" 2>/dev/null; exit 0' TERM INT + +failures=0 +while sleep "${CHECK_INTERVAL}"; do + kill -0 "${PY_PID}" 2>/dev/null || exit 1 + + curl -sS --max-time 5 -o /dev/null "http://127.0.0.1:${WS_PORT}/" 2>/dev/null + rc=$? + if [ "${rc}" -eq 28 ] || [ "${rc}" -eq 7 ]; then + failures=$((failures + 1)) + echo "[watchdog] pas de reponse (${failures}/${MAX_FAILURES}, curl=${rc})" + if [ "${failures}" -ge "${MAX_FAILURES}" ]; then + kill -TERM "${PY_PID}" 2>/dev/null + exit 1 + fi + else + failures=0 + fi +done diff --git a/devops_config/init.sh b/devops_config/init.sh deleted file mode 100644 index b86a076..0000000 --- a/devops_config/init.sh +++ /dev/null @@ -1,5 +0,0 @@ -apache2ctl restart -cd /var/www/html/Game/server/ -python main.py - -# A PLACER A LA RACINE DU PROJET \ No newline at end of file From f1cd70e2f99b5f878625b33ca91bcdd67f9ecd12 Mon Sep 17 00:00:00 2001 From: BlitzW! Date: Tue, 1 Sep 2026 20:07:38 +0200 Subject: [PATCH 4/4] test: stack de demo locale avec base jetable MySQL ephemere alimente par documents/bdd/ + deux comptes verifies (demo / joueur2, mot de passe DemoPass123!), la verification par mail n'existant pas en local. Fonctionne sans aucune variable ; PUBLIC_HOST et WEB_PORT permettent de la deployer ailleurs que sur localhost. Co-Authored-By: Claude Opus 5 (1M context) --- devops_config/demo-seed.sql | 4 +++ devops_config/demo.compose.yaml | 59 +++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 devops_config/demo-seed.sql create mode 100644 devops_config/demo.compose.yaml diff --git a/devops_config/demo-seed.sql b/devops_config/demo-seed.sql new file mode 100644 index 0000000..4548e1b --- /dev/null +++ b/devops_config/demo-seed.sql @@ -0,0 +1,4 @@ +INSERT INTO la_user (username, birthYear, email, password, verified, profilPicture, visibility, admin) +VALUES ('demo', 2000, 'demo@example.test', '$2y$10$moRKU1qQq0IpLY/alZeCqOHMCspBNJUccs4jClnaYoMRAVT.TIK7K', 1, '/img/profilepictures/strawberry.jpg', 'PUBLIC', 1); +INSERT INTO la_user (username, birthYear, email, password, verified, profilPicture, visibility, admin) +VALUES ('joueur2', 2000, 'joueur2@example.test', '$2y$10$moRKU1qQq0IpLY/alZeCqOHMCspBNJUccs4jClnaYoMRAVT.TIK7K', 1, '/img/profilepictures/strawberry.jpg', 'PUBLIC', 0); diff --git a/devops_config/demo.compose.yaml b/devops_config/demo.compose.yaml new file mode 100644 index 0000000..d838514 --- /dev/null +++ b/devops_config/demo.compose.yaml @@ -0,0 +1,59 @@ +services: + db: + image: mysql:8.0 + environment: + MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASS:-demoroot} + MYSQL_DATABASE: ${DB_NAME:-linksawordkening} + MYSQL_USER: ${DB_USER:-demo} + MYSQL_PASSWORD: ${DB_PASS:-demopass} + volumes: + - ../documents/bdd/linksawordkening-db.sql:/docker-entrypoint-initdb.d/01-schema.sql:ro + - ./demo-seed.sql:/docker-entrypoint-initdb.d/02-seed.sql:ro + - db-data:/var/lib/mysql + healthcheck: + test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "-uroot", "-p${DB_ROOT_PASS:-demoroot}"] + interval: 5s + timeout: 5s + retries: 30 + restart: unless-stopped + + web: + image: linksawordkening:demo + build: + context: .. + dockerfile: devops_config/dockerimage.dockerfile + args: + REACT_APP_API_URL: http://${PUBLIC_HOST:-localhost}:${WEB_PORT:-8080}/api/ + REACT_APP_WS_URL: ws://${PUBLIC_HOST:-localhost}:${WS_PORT:-8765}/game + WS_PATH: /game + environment: + DB_HOST: db + DB_NAME: ${DB_NAME:-linksawordkening} + DB_USER: ${DB_USER:-demo} + DB_PASS: ${DB_PASS:-demopass} + JWT_SECRET: ${JWT_SECRET:-demo0000000000000000000000000000000000000000000000000000000000} + JWT_DOMAIN: ${PUBLIC_HOST:-localhost} + MAIL_ADDRESS: demo@example.test + MAIL_PASSWORD: unused + APP_HOST: http://${PUBLIC_HOST:-localhost}:${WEB_PORT:-8080}/ + APP_API_URL: http://${PUBLIC_HOST:-localhost}:${WEB_PORT:-8080}/api/ + ports: + - "${WEB_PORT:-8080}:80" + depends_on: + db: + condition: service_healthy + restart: unless-stopped + init: true + + game: + image: linksawordkening:demo + command: /usr/local/bin/game-server.sh + ports: + - "${WS_PORT:-8765}:8765" + depends_on: + - web + restart: unless-stopped + init: true + +volumes: + db-data: