Skip to content

Commit

Permalink
fix: add DOCKER_DEFAULT_PLATFORM env var and verify required tools
Browse files Browse the repository at this point in the history
  • Loading branch information
pablon committed Nov 19, 2024
1 parent 409be26 commit 3dfe87d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions start-game.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ DOCKERFILE_GAME="${REPO_DIR}/Dockerfile"
DOCKER_COMPOSE_FILE="game-${GAME_TIMESTAMP}.yaml"
LOG_FILE="${LOG_DIR}/game-${GAME_TIMESTAMP}.log"
COMMAND_UP="docker compose -f ${DOCKER_COMPOSE_FILE} up --timestamps --abort-on-container-exit"
export DOCKER_DEFAULT_PLATFORM=linux/amd64

# yay colors
BLUE="\033[1;94m"
Expand Down Expand Up @@ -86,6 +87,11 @@ function _error() {
exit 1
}

# check required tools
(docker compose version &>/dev/null) || _error "Install docker compose first.${CLEAR}\n\thttps://docs.docker.com/compose/install/"
(type shuf &>/dev/null) || _error "Install 'coreutils' package first (required: shuf)."
(type awk &>/dev/null) || _error "Install 'awk' package first."

function divider() {
[[ "${COLUMNS}" ]] || COLUMNS=80
eval printf '=%.0s' {1..$COLUMNS}
Expand Down Expand Up @@ -349,6 +355,7 @@ _info "🚀 ${GREEN}Starting game!"
create_game_log
print_header
(
export DOCKER_DEFAULT_PLATFORM=linux/amd64
eval "${COMMAND_UP}"
) | tee -a "${LOG_FILE}"

Expand Down

0 comments on commit 3dfe87d

Please sign in to comment.