Last active
November 20, 2017 21:54
-
-
Save aheadley/99a5bd4a212aca1268702a4f111ac8c8 to your computer and use it in GitHub Desktop.
Docker container of a headless Linux Starcraft2 instance for bot development
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM frolvlad/alpine-glibc | |
ARG GAME_VERSION=3.17 | |
ENV GAME_VERSION ${GAME_VERSION:-3.17} | |
ARG GAME_PORT=12000 | |
ENV GAME_PORT ${GAME_PORT:-12000} | |
ARG GAME_DATA_VERSION=56787 | |
ENV GAME_DATA_VERSION ${GAME_DATA_VERSION:-56787} | |
ENV GAME_HOME ${GAME_HOME:-/home/sc2} | |
EXPOSE ${GAME_PORT} | |
RUN apk update && \ | |
apk add \ | |
bash unzip wget libstdc++ && \ | |
adduser -D sc2 | |
USER sc2 | |
COPY fetch-data.sh ${GAME_HOME}/fetch-data.sh | |
RUN ${GAME_HOME}/fetch-data.sh ${GAME_VERSION} ${GAME_HOME} | |
WORKDIR ${GAME_HOME}/StarCraftII | |
ENTRYPOINT exec ${GAME_HOME}/StarCraftII/Versions/Base${GAME_DATA_VERSION}/SC2_x64 \ | |
-dataDir "${GAME_HOME}/StarCraftII/" \ | |
-listen "0.0.0.0" \ | |
-port "${GAME_PORT}" \ | |
-verbose |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -x | |
GAME_VERSION="$1" | |
DEST="$2" | |
## | |
DATA_URL_BASE="http://blzdistsc2-a.akamaihd.net" | |
CLIENT_FILE="Linux/SC2.${GAME_VERSION}.zip" | |
MAP_FILES=( "MapPacks/Ladder2017Season1.zip" "MapPacks/Ladder2017Season2.zip" "MapPacks/Ladder2017Season3.zip" "MapPacks/Melee.zip" ) | |
REPLAY_FILES=( "ReplayPacks/3.16.1-Pack_1-fix.zip" "ReplayPacks/3.16.1-Pack_2.zip" ) | |
DATA_PASSWORD='iagreetotheeula' | |
MAP_DEST="StarCraftII/Maps" | |
mkdir -p "${DEST}/${MAP_DEST}" | |
# we fetch and unpack the maps first, then skip the whole bit if the client | |
# unpack completed successfully | |
if ! [ -f "${DEST}/StarCraftII/Versions/Base56787/SC2_x64" ]; then | |
for fn in "${MAP_FILES[@]}"; do | |
wget --timestamping --continue -qO "/tmp/$(basename ${fn})" "${DATA_URL_BASE}/${fn}" | |
unzip -n -P "${DATA_PASSWORD}" -d "${DEST}/${MAP_DEST}" "/tmp/$(basename ${fn})" | |
rm -f "/tmp/$(basename ${fn})" | |
done | |
wget --timestamping --continue -qO "/tmp/$(basename ${CLIENT_FILE})" "${DATA_URL_BASE}/${CLIENT_FILE}" | |
unzip -n -P "${DATA_PASSWORD}" -d "${DEST}" "/tmp/$(basename ${CLIENT_FILE})" | |
rm -f "/tmp/$(basename ${CLIENT_FILE})" | |
fi | |
find "${DEST}/StarCraftII" -type d | xargs chmod 755 | |
find "${DEST}/StarCraftII" -type f | xargs chmod 644 | |
find "${DEST}/StarCraftII/Libs" -type f | xargs chmod 755 | |
find "${DEST}/StarCraftII/Versions" -type f | xargs chmod 755 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment