Steamcmd in a ready to run docker image. For your convenience, there are two symlinks you can copy or mount:
/steamapps/config
docker run -it --name steamcmd left4devops/steamcmdMount a directory, login (as gabenin this example, some games allow you to download after logging in as anonymous) and download a game (222860, Left 4 Dead 2 Dedicated Server). You can lookup other App IDs on SteamDB.
docker run -it -v $(pwd)/steamapps:/steamapps --name steamcmd left4devops/steamcmd +login gaben +app_update 222860 +quitThis can be used to avoid providing your credentials when logging in to install authenticated content.
docker run -it --name steamcmd left4devops/steamcmd +login gaben +quit
docker cp steamcmd:/config/config.vdf .
docker rm steamcmdDownload using this image, then copy the output to a new image without any credentials to clean up.
Example Dockerfile
FROM left4devops/steamcmd AS credentials
RUN --mount=type=secret,uid=1000,gid=1000,id=steam,target=/config/config.vdf \
./steamcmd.sh +login gaben +app_update 222860 +quit
FROM rockylinux/rockylinux:9-minimal AS game
COPY --chown=1000:1000 --from=credentials \
"/steamapps/common/Left 4 Dead 2 Dedicated Server" \
/l4d2Provide the credentials for the above docker build --secret id=steam,src="$(pwd)/config.vdf" .
docker build -t left4devops/steamcmd .