(feat): add docker
This commit is contained in:
parent
4df7057642
commit
ba045c37ab
3 changed files with 77 additions and 0 deletions
30
docker/Dockerfile
Normal file
30
docker/Dockerfile
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
FROM ubuntu:24.04 AS builder
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
build-essential cmake libssl-dev && rm -rf /var/lib/apt/lists/*
|
||||
WORKDIR /build
|
||||
COPY CMakeLists.txt ./
|
||||
COPY src/ src/
|
||||
|
||||
# TIBIA722=1 its already centralized in the CMakeLists
|
||||
# QM_DATABASE=sqlite: the db stays as SQLITE with amalgamation bundled.
|
||||
RUN cmake -B build -DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUILD_GAME=ON -DBUILD_LOGIN=ON -DBUILD_QUERYMANAGER=ON \
|
||||
-DQM_DATABASE=sqlite \
|
||||
&& cmake --build build -j"$(nproc)"
|
||||
|
||||
# We verify if there's any binary missing
|
||||
RUN ls -la /build/build/bin/game /build/build/bin/login /build/build/bin/querymanager
|
||||
|
||||
FROM ubuntu:24.04
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
libssl3 sqlite3 && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --from=builder /build/build/bin/game /opt/tibia/game-bin/game
|
||||
COPY --from=builder /build/build/bin/login /opt/tibia/login-bin/login
|
||||
COPY --from=builder /build/build/bin/querymanager /opt/tibia/qm-bin/querymanager
|
||||
COPY --from=builder /build/src/querymanager/sqlite /opt/tibia/qm-sqlite
|
||||
COPY --from=builder /build/src/querymanager/config.cfg.dist /opt/tibia/qm-config.cfg
|
||||
COPY --from=builder /build/src/login/config.cfg.dist /opt/tibia/login-config.cfg
|
||||
COPY entrypoint.sh /opt/tibia/entrypoint.sh
|
||||
RUN chmod +x /opt/tibia/entrypoint.sh && mkdir /tibia-db
|
||||
ENTRYPOINT ["/opt/tibia/entrypoint.sh"]
|
||||
16
docker/docker-compose.yml
Normal file
16
docker/docker-compose.yml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
services:
|
||||
zanera-kaplar:
|
||||
build: .
|
||||
container_name: ots-zanera-kaplar
|
||||
restart: unless-stopped
|
||||
stop_grace_period: 15m # Save from 2006 could get slow; wait before SIGKILL
|
||||
ports:
|
||||
- "7171:7171"
|
||||
- "7172:7172"
|
||||
volumes:
|
||||
- ./data:/game
|
||||
- ./qm-db:/tibia-db
|
||||
- ./ot.pem:/opt/tibia/tibia.pem:ro
|
||||
- ./ot.pem:/opt/tibia/tibia-login.pem:ro
|
||||
stdin_open: true
|
||||
tty: true
|
||||
31
docker/entrypoint.sh
Normal file
31
docker/entrypoint.sh
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# 1. QM: directorio de trabajo con sqlite/ DENTRO de su cwd
|
||||
mkdir -p /opt/tibia/qm /opt/tibia/login
|
||||
rm -rf /opt/tibia/qm/sqlite
|
||||
cp -a /opt/tibia/qm-sqlite /opt/tibia/qm/sqlite
|
||||
mkdir -p /opt/tibia/qm/sqlite/patches
|
||||
cp -f /opt/tibia/qm/sqlite/z-999-initial-data.sql /opt/tibia/qm/sqlite/patches/
|
||||
|
||||
# 2. Configs (copiar PRIMERO, editar DESPUÉS)
|
||||
cp -f /opt/tibia/qm-config.cfg /opt/tibia/qm/config.cfg
|
||||
cp -f /opt/tibia/login-config.cfg /opt/tibia/login/config.cfg
|
||||
cp -f /opt/tibia/tibia-login.pem /opt/tibia/login/tibia.pem
|
||||
sed -i 's|SQLite.File.*|SQLite.File = "/tibia-db/tibia.db"|' /opt/tibia/qm/config.cfg
|
||||
sed -i 's/ClientVersion.*/ClientVersion = "7.72"/; s/ServerVersion.*/ServerVersion = "7.72"/' /opt/tibia/login/config.cfg
|
||||
|
||||
# 3. QM arriba (schema + patches con la semilla Zanera/111111)
|
||||
cd /opt/tibia/qm && /opt/tibia/qm-bin/querymanager &
|
||||
sleep 3
|
||||
|
||||
# 4. Login arriba (7171)
|
||||
cd /opt/tibia/login && /opt/tibia/login-bin/login &
|
||||
sleep 2
|
||||
|
||||
# 5. Game kaplar sobre la data original
|
||||
cp -f /opt/tibia/tibia.pem /game/tibia.pem
|
||||
rm -f /game/save/game.pid
|
||||
cp -f /opt/tibia/game-bin/game /game/bin/game
|
||||
cd /game
|
||||
exec ./bin/game
|
||||
Loading…
Reference in a new issue