DarkflameServer/docker/Dockerfile

66 lines
1.8 KiB
Docker

FROM gcc:11 as build
WORKDIR /build
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 zlib1g-dev unzip -yqq --no-install-recommends && \
rm -rf /var/lib/apt/lists/*
COPY dAuthServer/ /build/dAuthServer
COPY dChatServer/ /build/dChatServer
COPY dCommon/ /build/dCommon
COPY dChatFilter/ /build/dChatFilter
COPY dDatabase/ /build/dDatabase
COPY dGame/ /build/dGame
COPY dMasterServer/ /build/dMasterServer
COPY dNet/ /build/dNet
COPY dPhysics/ /build/dPhysics
COPY dScripts/ /build/dScripts
COPY dWorldServer/ /build/dWorldServer
COPY dZoneManager/ /build/dZoneManager
COPY migrations/ /build/migrations
COPY resources/ /build/resources
COPY thirdparty/ /build/thirdparty
COPY vanity /build/vanity
COPY .clang-* CMake* LICENSE /build/
ARG BUILD_THREADS=1
ARG BUILD_VERSION=171022
RUN echo "Build server" && \
mkdir -p build && \
cd build && \
sed -i -e "s/171022/${BUILD_VERSION}/g" ../CMakeVariables.txt && \
cmake .. && \
make -j $BUILD_THREADS
RUN unzip /build/resources/navmeshes.zip -d /build/build/res/maps
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
COPY --from=build /build/build /app
COPY --from=build /build/migrations /app/migrations
RUN mkdir -p /build/build && ln -s /app/_deps /build/build/_deps
ADD docker/*.py /app/utils/
COPY docker/start_server.sh /start_server.sh
RUN chmod +x /start_server.sh
RUN mkdir /app/logs
CMD [ "/start_server.sh" ]