Skip to content

Commit

Permalink
Merge pull request #345 from MartinFillon/make-a-docker-compose
Browse files Browse the repository at this point in the history
Make a docker compose
  • Loading branch information
MartinFillon authored Jun 23, 2024
2 parents 1a50ec2 + c08071f commit a9a1e6d
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ RUN make -C server re

EXPOSE 4242

CMD ["./zappy_server", "-p", "4242", "-n", "team1", "team2", "-l", "INFO", "--docker"]
ENTRYPOINT [ "./docker/entrypoint.sh" ]
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ It is advised to run `zappy_server` first
- `clientsNb` is the number of authorized clients per team
- `freq` is the reciprocal of time unit for execution of actions

It can also be runned using docker, by either building the image yourself or using the docker compose.

If you want to configure the server using the docker compose you have access to multiple env vars:

- `ZAPPY_LOG_LEVEL` for the log level `-l`
- `ZAPPY_TEAM_NAMES` for the team names `-n`
- `ZAPPY_CLIENT_NUMBER` for the client count `-c`
- `ZAPPY_FREQUENCY` for the frequency `-f`
- `ZAPPY_WIDTH` for the width `-x`
- `ZAPPY_HEIGHT` for the height `-y`

## AI

```sh
Expand Down
8 changes: 8 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
poll:
build: .
restart: on-failure
ports:
- 4242:4242
environment:
- ZAPPY_LOG_LEVEL=WARNING
12 changes: 12 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

LOG_LEVEL=${ZAPPY_LOG_LEVEL:-INFO}
TEAM_NAMES=${ZAPPY_TEAM_NAMES:-"team1 team2"}
CLIENT_NUMBER=${ZAPPY_CLIENT_NUMBER:-4}
FREQUENCY=${ZAPPY_FREQUENCY:-100}
DISPLAYER="server/base.so"
PORT=4242
WIDTH=${ZAPPY_WIDTH:-10}
HEIGHT=${ZAPPY_HEIGHT:-10}

./zappy_server -p $PORT -x $WIDTH -y $HEIGHT -n $TEAM_NAMES -c $CLIENT_NUMBER -f $FREQUENCY -d $DISPLAYER -l $LOG_LEVEL --docker

0 comments on commit a9a1e6d

Please sign in to comment.