Compare commits
No commits in common. "3f9f6999b013535285ae9354b8b22d7d0616bed0" and "1f4bc2892ae65ee23d7727550881c7d2b5855862" have entirely different histories.
3f9f6999b0
...
1f4bc2892a
2 changed files with 60 additions and 46 deletions
86
Dockerfile
86
Dockerfile
|
@ -1,48 +1,62 @@
|
|||
# first image, simply get/unpack the steamcmd tarball
|
||||
FROM fedora:39 as builder
|
||||
LABEL maintainer="me@jlay.io" \
|
||||
org.opencontainers.image.authors="me@jlay.io"
|
||||
WORKDIR /root
|
||||
RUN curl -sq http://media.steampowered.com/installer/steamcmd_linux.tar.gz | tar -xvz
|
||||
# based on 'CM2Walki/steamcmd'
|
||||
# modified for a more familiar/up-to-date base (fedora+test run)
|
||||
|
||||
# second/real image: copy the unpacked tarball into an updated/prepared Fedora environment
|
||||
FROM fedora:39
|
||||
FROM fedora:35
|
||||
LABEL maintainer="me@jlay.io" \
|
||||
org.opencontainers.image.authors="me@jlay.io"
|
||||
ENV PATH="/opt/steamcmd:${PATH}"
|
||||
|
||||
# site customizations below, change as necessary (eg: to match Docker volume host UID/GID owners)
|
||||
ARG PUID=1001
|
||||
ARG PGID=1002
|
||||
|
||||
# set the user, homedir, and steamcmd directories as (env) variables
|
||||
ENV USER steam
|
||||
ENV HOMEDIR "/home/${USER}"
|
||||
ENV STEAMCMDDIR "${HOMEDIR}/steamcmd"
|
||||
|
||||
# Install, update & upgrade packages
|
||||
RUN set -x ; \
|
||||
mkdir -vp /opt/steamcmd/linux32 ; \
|
||||
sed -i -e 's/^LANG=".*"$/LANG="en_US.UTF-8"/' /etc/locale.conf ; \
|
||||
(echo -e 'max_parallel_downloads=20\nfastestmirror=False\ndeltarpm=False' | tee -a /etc/dnf/dnf.conf) ; \
|
||||
dnf --setopt=logdir=/tmp/dnf-prep-logs --setopt=cachedir=/tmp/dnf-prep-cache -qy up ; \
|
||||
dnf --setopt=logdir=/tmp/dnf-prep-logs --setopt=cachedir=/tmp/dnf-prep-cache -qy install \
|
||||
# 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 -qy \
|
||||
util-linux \
|
||||
findutils \
|
||||
wget \
|
||||
ca-certificates \
|
||||
libgcc.{x86_64,i686} \
|
||||
vim \
|
||||
less \
|
||||
curl \
|
||||
libstdc++.{x86_64,i686} \
|
||||
libgcc.{x86_64,i686} \
|
||||
glibc.{x86_64,i686} \
|
||||
SDL2.{x86_64,i686} \
|
||||
glibc-langpack-en ; \
|
||||
find /tmp/dnf-prep-logs /tmp/dnf-prep-cache -delete
|
||||
&& dnf -qy up \
|
||||
&& dnf clean all \
|
||||
&& 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\"" \
|
||||
&& echo -e "#\!/bin/bash\npushd ${STEAMCMDDIR}\n./steamcmd.sh\npopd" | tee -a /usr/local/bin/steamcmd \
|
||||
&& chmod -v +x /usr/local/bin/steamcmd \
|
||||
&& ln -s "${STEAMCMDDIR}/linux64/steamclient.so" "/usr/lib64/steamclient.so" \
|
||||
&& ${STEAMCMDDIR}/steamcmd.sh +quit
|
||||
|
||||
# from the builder, copy the extracted steamcmd bits
|
||||
# COPY doesn't take directories with it, only their contents. so dumb.
|
||||
COPY --from=builder /root/steam*.sh /opt/steamcmd
|
||||
COPY --from=builder /root/linux32/* /opt/steamcmd/linux32/
|
||||
WORKDIR ${STEAMCMDDIR}
|
||||
|
||||
# Make the Steam libraries permanently part of the environment
|
||||
# for those who this inspires, a note:
|
||||
# I would only recommend this *in containers*.
|
||||
# it's remarkably easy to break loosely-linked software like this.
|
||||
RUN echo '/opt/steamcmd/linux32' | tee /etc/ld.so.conf.d/steam.conf ; ldconfig ; \
|
||||
ln -sv /opt/steamcmd/linux32/steam{client,service}.so
|
||||
# also, map steamclient.so -> steamservice.so. this silences some complaints
|
||||
|
||||
# test steamcmd; ensure function and updates
|
||||
RUN steamcmd.sh +quit
|
||||
|
||||
# default cmd, steamcmd 'installed' to /opt. required extending $PATH in env above
|
||||
ENTRYPOINT ["steamcmd.sh"]
|
||||
CMD ["+help", ""+quit"]
|
||||
VOLUME ${STEAMCMDDIR}
|
||||
|
|
|
@ -7,14 +7,14 @@ 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}"
|
||||
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}"
|
||||
podman rmi steamcmd:${BUILD_TAG}
|
||||
echo ""
|
||||
echo "Attempting to compress the image (begin comforting music)"
|
||||
xz --keep --compress -9 --extreme --threads="$(nproc)" "${IMAGE_FILE}"
|
||||
xz --keep --compress -9 --extreme --threads=$(nproc) ${IMAGE_FILE}
|
||||
echo ""
|
||||
echo "Finished, (non)compressed images created:"
|
||||
ls --color=auto -lah "${IMAGE_FILE}"*
|
||||
ls --color=auto -lah ${IMAGE_FILE}*
|
||||
|
|
Loading…
Reference in a new issue