From e714cacc58dee3c69eccc4802313b2339d38e8b6 Mon Sep 17 00:00:00 2001 From: Nils Bergmann Date: Tue, 7 Dec 2021 22:25:58 +0100 Subject: [PATCH] WIP: produce valid MasterServer binary --- docker-compose.yml | 2 ++ docker/Dockerfile | 30 ++++++++++++------------------ docker/start_server.sh | 4 ++-- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 1c78e10a..9377e772 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -31,6 +31,8 @@ services: - DATABASE_PASSWORD=${MARIADB_PASSWORD:-darkflame} volumes: - $CLIENT_PATH:/client + depends_on: + - database networks: darkflame: diff --git a/docker/Dockerfile b/docker/Dockerfile index 9d1d4a36..4d1ba116 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,17 +1,13 @@ -FROM debian:11-slim as build +FROM gcc:11 as build WORKDIR /build -RUN --mount=type=cache,target=/var/cache/apt \ +RUN --mount=type=cache,id=build-apt-cache,target=/var/cache/apt \ echo "Install build dependencies" && \ apt update && \ apt remove -y libmysqlcppconn7v5 libmysqlcppconn-dev && \ - apt install cmake zlib1g-dev make gcc g++ build-essential unzip ca-certificates wget -yqq --no-install-recommends && \ - rm -rf /var/lib/apt/lists/* && \ - update-ca-certificates && \ - wget https://dev.mysql.com/get/Downloads/Connector-C++/libmysqlcppconn9_8.0.27-1debian11_amd64.deb -O /tmp/libmysqlcppconn9_8.0.27-1debian11_amd64.deb && \ - dpkg -i /tmp/libmysqlcppconn9_8.0.27-1debian11_amd64.deb && \ - rm -rf /tmp/libmysqlcppconn9_8.0.27-1debian11_amd64.deb + apt install cmake zlib1g zlib1g-dev unzip -yqq --no-install-recommends && \ + rm -rf /var/lib/apt/lists/* COPY dAuthServer/ /build/dAuthServer COPY dChatServer/ /build/dChatServer @@ -44,7 +40,13 @@ RUN echo "Build server" && \ RUN mkdir -p /build/build/res/maps/navmeshes/ && \ unzip /build/resources/navmeshes.zip -d /build/build/res/maps -FROM debian:11-slim as runtime +FROM gcc:11 as runtime + +RUN --mount=type=cache,id=runtime-apt-cache,target=/var/cache/apt \ + apt update && \ + apt install mariadb-client python3 sudo sqlite3 -yqq --no-install-recommends && \ + apt remove -y libmysqlcppconn7v5 libmysqlcppconn-dev && \ + rm -rf /var/lib/apt/lists/* WORKDIR /app @@ -52,15 +54,7 @@ COPY --from=build /build/build /app COPY --from=build /build/migrations /app/migrations -RUN --mount=type=cache,target=/var/cache/apt \ - apt update && \ - apt install mariadb-client python3 sqlite3 ca-certificates wget -yqq --no-install-recommends && \ - apt remove -y libmysqlcppconn7v5 libmysqlcppconn-dev && \ - rm -rf /var/lib/apt/lists/* && \ - update-ca-certificates && \ - wget https://dev.mysql.com/get/Downloads/Connector-C++/libmysqlcppconn9_8.0.27-1debian11_amd64.deb -O /tmp/libmysqlcppconn9_8.0.27-1debian11_amd64.deb && \ - dpkg -i /tmp/libmysqlcppconn9_8.0.27-1debian11_amd64.deb && \ - rm -rf /tmp/libmysqlcppconn9_8.0.27-1debian11_amd64.deb +RUN mkdir -p /build/build && ln -s /app/_deps /build/build/_deps ADD docker/*.py /app/utils/ diff --git a/docker/start_server.sh b/docker/start_server.sh index 87c3e289..5797313d 100644 --- a/docker/start_server.sh +++ b/docker/start_server.sh @@ -44,7 +44,7 @@ function update_database_ini_values_for() { update_ini $INI_FILE mysql_host $DATABASE_HOST update_ini $INI_FILE mysql_database $DATABASE update_ini $INI_FILE mysql_username $DATABASE_USER - update_ini $INI_FILE mysql_password $USE_DATABASE_PASSWORD + update_ini $INI_FILE mysql_password $DATABASE_PASSWORD } function update_ini_values() { @@ -75,7 +75,7 @@ function fdb_to_sqlite() { readarray -d '' entries < <(printf '%s\0' *.sql | sort -zV) for entry in "${entries[@]}"; do echo "Execute $entry" - sqlite3 ../../res/CDServer.sqlite < $entry + sqlite3 /app/res/CDServer.sqlite < $entry done ) }