Compare commits

...

4 Commits

Author SHA1 Message Date
Lion Kortlepel
5f456584a8 use lua 5.3.6 for static build 2022-09-29 11:19:20 +02:00
Lion Kortlepel
b88b64cd0e update docker-build.sh to add an option to run-only 2022-09-28 00:01:09 +02:00
Lion Kortlepel
dccdd3f5f2 add ability to change openssl and zlib 2022-09-27 23:46:19 +02:00
Lion Kortlepel
ae38f01fdc add initial docker static build container 2022-09-27 23:41:47 +02:00
3 changed files with 54 additions and 4 deletions

View File

@@ -90,11 +90,28 @@ add_subdirectory(deps)
# ------------------------ VARIABLES ---------------------------------
include(FindLua)
option(FIND_OPENSSL "Whether or not to find openssl automatically (keep on unless you know what you're doing)" ON)
option(FIND_ZLIB "Whether or not to find zlib automatically (keep on unless you know what you're doing)" ON)
include(FindOpenSSL)
if (${FIND_OPENSSL})
set(OPENSSL_CRYPTO OpenSSL::Crypto)
set(OPENSSL_SSL OpenSSL::SSL)
else()
message(STATUS "Using custom openssl libs: ${OPENSSL_CRYPTO} ${OPENSSL_SSL}")
endif()
include(FindLua)
include(FindThreads)
include(FindZLIB)
if (${FIND_ZLIB})
set(ZLIB_ZLIB ZLIB::ZLIB)
else()
message(STATUS "Using custom zlib: ${ZLIB_ZLIB}")
endif()
set(BeamMP_Sources
include/TConsole.h src/TConsole.cpp
include/TServer.h src/TServer.cpp
@@ -171,12 +188,12 @@ endif()
set(BeamMP_Libraries
doctest::doctest
OpenSSL::SSL
OpenSSL::Crypto
${OPENSSL_SSL}
${OPENSSL_CRYPTO}
sol2::sol2
fmt::fmt
Threads::Threads
ZLIB::ZLIB
${ZLIB_ZLIB}
${LUA_LIBRARIES}
commandline
sentry

11
Dockerfile Normal file
View File

@@ -0,0 +1,11 @@
FROM lionkor/alpine-static-cpp:latest
ARG LUA_V=5.3.6
RUN apk update && apk --no-cache add python3 git lua zlib-static openssl curl rapidjson curl-dev wget readline-static
RUN apk --no-cache add openssl-libs-static curl-static readline-dev
RUN wget "https://www.lua.org/ftp/lua-${LUA_V}.tar.gz"; tar xzvf lua-${LUA_V}.tar.gz; mv "lua-${LUA_V}" /lua; rm lua-${LUA_V}.tar.gz
RUN cd /lua; make all -j linux; cd ..

22
docker-build.sh Executable file
View File

@@ -0,0 +1,22 @@
#!/bin/sh
# usage:
# ./docker-build.sh
# builds the image, and then runs it
# ./docker-build.sh run
# only runs it
set -e
if [ "$1" != "run" ]
then
git submodule update --init --recursive
docker build . --tag beammp-static
fi
docker run -v $(pwd):/root -it --rm beammp-static sh -c "cd root; cmake . -B build -DGIT_SUBMODULE=OFF -DLUA_INCLUDE_DIR=/lua/src -DSOL2_SINGLE=ON -DFIND_OPENSSL=OFF -DOPENSSL_CRYPTO=\"/usr/lib/libcrypto.a\" -DOPENSSL_SSL=\"/usr/lib/libssl.a\" -DFIND_ZLIB=OFF -DZLIB_ZLIB=/lib/libz.a -DCURL_FOUND=ON -DCURL_LIBRARIES=\"/usr/lib/libcurl.a\" -DLUA_LIBRARIES=\"/lua/src/liblua.a\" -DSENTRY_BACKEND=none -DSENTRY_TRANSPORT=none; make -C build -j BeamMP-Server"
# try to chown the build directory afterwards
sudo chown -R "$USER":"$USER" build