This commit is contained in:
Josh Lay 2021-11-16 18:27:39 -06:00
commit b0abd0079e
4 changed files with 82 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
steamcmd-fedora-*.img*
*.swp

55
Dockerfile Normal file
View file

@ -0,0 +1,55 @@
# based on 'CM2Walki/steamcmd'
# modified for a more familiar/up-to-date base (fedora+test run)
FROM fedora:35
LABEL maintainer="me@jlay.io" \
org.opencontainers.image.authors="me@jlay.io"
ARG PUID=1000
ENV USER steam
ENV HOMEDIR "/home/${USER}"
ENV STEAMCMDDIR "${HOMEDIR}/steamcmd"
# Install, update & upgrade packages
# Create user for the server
# This also creates the home directory we later need
# Clean TMP, dnf cache and other stuff to make the image smaller
# Create Directory for SteamCMD
# Download SteamCMD
# Extract and delete archive
# Run steamcmd once to test things out/let it update
#
# NOTE: steamcmd doesn't appreciate the 'upstream' LANG:
# WARNING: setlocale('en_US.UTF-8') failed, using locale: 'C'. International characters may not work.
# may drop this.
RUN set -x \
&& sed -i -e 's/^LANG=".*"$/LANG="en_US.UTF-8"/' /etc/locale.conf \
&& echo -e 'max_parallel_downloads=20\nfastestmirror=False\ndeltarpm=False\n' | tee -a /etc/dnf/dnf.conf \
&& dnf install -y \
util-linux \
findutils \
wget \
ca-certificates \
vim \
SDL2.{x86_64,i686} \
less \
curl \
libstdc++.{x86_64,i686} \
libgcc.{x86_64,i686} \
glibc.{x86_64,i686} \
&& useradd -u "${PUID}" -m "${USER}" \
&& su "${USER}" -c \
"mkdir -p \"${STEAMCMDDIR}\" \
&& wget -qO- 'https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz' | tar xvzf - -C \"${STEAMCMDDIR}\" \
&& \"./${STEAMCMDDIR}/steamcmd.sh\" +quit \
&& mkdir -p \"${HOMEDIR}/.steam/sdk32\" \
&& ln -s \"${STEAMCMDDIR}/linux32/steamclient.so\" \"${HOMEDIR}/.steam/sdk32/steamclient.so\" \
&& ln -s \"${STEAMCMDDIR}/linux32/steamcmd\" \"${STEAMCMDDIR}/linux32/steam\" \
&& ln -s \"${STEAMCMDDIR}/steamcmd.sh\" \"${STEAMCMDDIR}/steam.sh\"" \
&& ln -s "${STEAMCMDDIR}/linux64/steamclient.so" "/usr/lib64/steamclient.so" \
&& dnf clean all \
&& ${STEAMCMDDIR}/steamcmd.sh +quit
WORKDIR ${STEAMCMDDIR}
VOLUME ${STEAMCMDDIR}

6
README.md Normal file
View file

@ -0,0 +1,6 @@
### steamcmd-docker
Extended version of [CM2Walki/steamcmd] (https://www.github.com/CM2Walki/steamcmd)
Based on Fedora 35, a newer/more familiar OS (for me). Runs `steamcmd` once on build to update the client from the archive. No other notable changes.
Some bootstrap utilities left around for convenience (eg: `wget`, `less`, `find`), at the cost of size. That is *not* a priority for this image, nearing 500MB.

19
build-image-files.sh Executable file
View file

@ -0,0 +1,19 @@
#!/bin/bash
# base vars
NOW=$(date +%s) # epoch timestamp, eg: 1622772927
BASE_TAG=$(awk '$1 == "FROM" {print $2}' Dockerfile | cut -d\: -f2) # eg: 2.7.1
BUILD_TAG="fedora-${BASE_TAG}-${NOW}"
IMAGE_FILE="steamcmd-${BUILD_TAG}.img"
echo "Building image steamcmd:${BUILD_TAG}"
podman build --tag steamcmd:${BUILD_TAG} .
podman save localhost/steamcmd:${BUILD_TAG} > ${IMAGE_FILE}
echo ""
echo "Wrote ${IMAGE_FILE}, cleaning up"
podman rmi steamcmd:${BUILD_TAG}
echo "Attempting to compress the image (begin comforting music)"
xz --keep --compress -9 --extreme --threads=$(nproc) ${IMAGE_FILE}
echo ""
echo "Finished, (non)compressed images created:"
ls -lah ${IMAGE_FILE}*