Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bot Docker: how-to-run steps & parameterize Dockerfile #12761

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
```