Skip to content

Commit

Permalink
Bot Docker: how-to-run steps & parameterize Dockerfile (#12761)
Browse files Browse the repository at this point in the history
  • Loading branch information
DanVanAtta authored Jul 24, 2024
1 parent 791b06a commit 49c6cbd
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
10 changes: 9 additions & 1 deletion game-app/game-headless/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@ FROM openjdk:11-jre-slim-buster
EXPOSE 4000
ENV BOT_NAME=BotDocker01
ENV LOBBY_URI=http://localhost:3000
RUN mkdir /downloadedMaps
ENV BOT_MAX_MEMORY="256M"
ENV BOT_XSS="1250k"

ENV MAPS_FOLDER=/downloadedMaps
ENV EXIT_ON_GAME_END=FALSE

RUN mkdir $MAPS_FOLDER

ADD build/libs/triplea-game-headless.jar /
CMD java \
-Xmx$BOT_MAX_MEMORY \
-Xss$BOT_XSS \
-Dtriplea.name=$BOT_NAME \
-Dtriplea.port=4000 \
-Dtriplea.lobby.uri=$LOBBY_URI \
-Dtriplea.exit.on.game.end=$EXIT_ON_GAME_END \
-jar triplea-game-headless.jar
22 changes: 22 additions & 0 deletions game-app/game-headless/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,25 @@ cd work/triplea/triplea/game-app/game-headless/

Start Triplea-Game, in 'settings' > 'testing', update Lobby URI to be: `http://localhost:3000`,
'save' & then connect to lobby via 'play online'.


### Running bots (on prod)


### Linux:

Below script opens firewall port 4000, downloads latest bot image & starts it.

```bash
BOT_NAME=....change_me.....

sudo ufw allow 4000
docker pull ghcr.io/triplea-game/bot:latest
MAPS_FOLDER=/home/$USER/triplea/downloadedMaps
docker run \
--env BOT_NAME=$BOT_NAME \
--env LOBBY_URI=https://prod.triplea-game.org \
-v $MAPS_FOLDER:/downloadedMaps \
-p 4000:4000 \
ghcr.io/triplea-game/bot:latest
```

0 comments on commit 49c6cbd

Please sign in to comment.