add build mechanism for nng

This commit is contained in:
Alexander Bentkamp
2023-03-23 16:23:06 +01:00
parent 7992cffa26
commit dac15d84b5
5 changed files with 20 additions and 5 deletions
+11 -1
View File
@@ -6,6 +6,16 @@ cd $(dirname $0)
# Build elan image if not already present
docker build --pull --rm -f elan.Dockerfile -t elan:latest .
# Build testgame
(cd testgame && lake exe cache get && lake build)
docker rmi testgame:latest || true
docker build --rm -f server.Dockerfile -t testgame:latest .
docker build \
--build-arg GAME_DIR=testgame \
--rm -f server.Dockerfile -t testgame:latest .
# Build NNG
(cd nng && lake build)
docker rmi nng:latest || true
docker build \
--build-arg GAME_DIR=nng \
--rm -f server.Dockerfile -t nng:latest .
+2 -1
View File
@@ -45,7 +45,8 @@ function startServerProcess(gameId) {
["--server", gameId, games[gameId].module, games[gameId].name],
{ cwd: "./leanserver/build/bin/" })
: cp.spawn("docker",
["run", "--runtime=runsc", "--network=none", "--rm", "-i", `${gameId}:latest`],
["run", "--runtime=runsc", "--network=none", "--rm", "-i", `${gameId}:latest`,
"./gameserver", "--server", gameId, games[gameId].module, games[gameId].name],
{ cwd: "." })
serverProcess.on('error', error =>
console.error(`Launching Lean Server failed: ${error}`)
+2 -2
View File
@@ -1,10 +1,11 @@
ARG GAME_DIR
FROM elan:latest
WORKDIR /
# Copy lean files
COPY leanserver ./leanserver
COPY testgame ./testgame
COPY $GAME_DIR ./$GAME_DIR
# TODO: make `testgame` a build argument
WORKDIR /leanserver
@@ -12,4 +13,3 @@ RUN rm -f ./build/bin/gameserver
RUN lake build
WORKDIR /leanserver/build/bin/
CMD ["./gameserver", "--server", "testgame", "TestGame", "TestGame"]