DarkflameServer/docker/Dockerfile

59 lines
1.7 KiB
Docker
Raw Normal View History

2021-12-07 21:25:58 +00:00
FROM gcc:11 as build
2021-12-07 13:50:05 +00:00
WORKDIR /build
2021-12-07 21:25:58 +00:00
RUN --mount=type=cache,id=build-apt-cache,target=/var/cache/apt \
2021-12-07 13:50:05 +00:00
echo "Install build dependencies" && \
apt update && \
apt remove -y libmysqlcppconn7v5 libmysqlcppconn-dev && \
2021-12-07 21:25:58 +00:00
apt install cmake zlib1g zlib1g-dev unzip -yqq --no-install-recommends && \
rm -rf /var/lib/apt/lists/*
2021-12-07 13:50:05 +00:00
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
2022-01-05 16:21:25 +00:00
COPY tests/ /build/tests
2021-12-07 13:50:05 +00:00
COPY .clang-* CMake* LICENSE /build/
ARG BUILD_THREADS=1
2021-12-07 15:29:26 +00:00
ARG BUILD_VERSION=171022
2021-12-07 13:50:05 +00:00
RUN echo "Build server" && \
2022-01-05 16:38:53 +00:00
mkdir -p cmake_build && \
cd cmake_build && \
sed -i -e "s/171022/${BUILD_VERSION}/g" ../CMakeVariables.txt && \
2021-12-07 15:29:26 +00:00
cmake .. && \
make -j $BUILD_THREADS
2022-01-05 16:38:53 +00:00
RUN unzip /build/resources/navmeshes.zip -d /build/cmake_build/res/maps
2021-12-07 15:29:26 +00:00
2021-12-07 21:25:58 +00:00
FROM gcc:11 as runtime
RUN --mount=type=cache,id=runtime-apt-cache,target=/var/cache/apt \
2021-12-07 21:25:58 +00:00
apt update && \
apt install sudo -yqq --no-install-recommends && \
2021-12-07 21:25:58 +00:00
apt remove -y libmysqlcppconn7v5 libmysqlcppconn-dev && \
rm -rf /var/lib/apt/lists/*
2021-12-07 13:50:05 +00:00
WORKDIR /app
2022-01-05 16:38:53 +00:00
COPY --from=build /build/cmake_build /app
2021-12-07 15:29:26 +00:00
2022-01-05 16:38:53 +00:00
RUN mkdir -p /build/cmake_build && ln -s /app/_deps /build/cmake_build/_deps
2021-12-07 15:29:26 +00:00
2021-12-07 13:50:05 +00:00
COPY docker/start_server.sh /start_server.sh
CMD [ "/start_server.sh" ]