SteamCMD podman compatible openSUSE contianer
This is the initial work. Will add labels w/e Signed-off-by: Pratyush Desai <pratyush.desai@liberta.casa>
This commit is contained in:
commit
5f7d650161
45
Containerfile
Normal file
45
Containerfile
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# Stage 1: Build SteamCMD environment
|
||||||
|
FROM opensuse/leap:15.6 AS builder
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
RUN --mount=type=cache,id=sle-pkgs,sharing=locked,target=/var/cache/zypp zypper --non-interactive update && \
|
||||||
|
zypper --non-interactive install \
|
||||||
|
bzip2 ca-certificates curl libarchive13 glibc-32bit libgcc_s1-32bit p7zip tar unzip gzip wget xz
|
||||||
|
|
||||||
|
ENV LANG=en_US.UTF-8
|
||||||
|
ENV LANGUAGE=en_US.UTF-8
|
||||||
|
ENV HOME=/app
|
||||||
|
|
||||||
|
RUN groupadd -g 1000 steamcmd && \
|
||||||
|
useradd -u 1000 -g 1000 -d /app -s /bin/bash steamcmd && \
|
||||||
|
mkdir -p /app /output && \
|
||||||
|
chown 1000:1000 -R /app && \
|
||||||
|
chown 1000:1000 -R /output
|
||||||
|
|
||||||
|
USER steamcmd
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Download SteamCMD; run it once for self-updates
|
||||||
|
RUN wget -qO- http://media.steampowered.com/installer/steamcmd_linux.tar.gz | tar xz -C /app && \
|
||||||
|
chmod +x /app/steamcmd.sh && \
|
||||||
|
./steamcmd.sh +force_install_dir /output +login anonymous +quit
|
||||||
|
|
||||||
|
COPY --chown=1000:1000 setuser.sh /usr/local/bin/setuser.sh
|
||||||
|
RUN chmod +x /usr/local/bin/setuser.sh
|
||||||
|
|
||||||
|
# Stage 2: Final Image
|
||||||
|
FROM opensuse/leap:15.6
|
||||||
|
|
||||||
|
# Copy SteamCMD files from builder stage
|
||||||
|
COPY --from=builder /app /app
|
||||||
|
COPY --from=builder /output /output
|
||||||
|
COPY --from=builder /usr/local/bin/setuser.sh /usr/local/bin/setuser.sh
|
||||||
|
|
||||||
|
RUN chmod +x /usr/local/bin/setuser.sh
|
||||||
|
|
||||||
|
ENV HOME=/app
|
||||||
|
USER steamcmd
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
|
||||||
|
CMD ["/app/steamcmd.sh", "+quit"]
|
||||||
24
setuser.sh
Normal file
24
setuser.sh
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# setuser.sh: Helper script to set the user and group.
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "Usage: setuser.sh <username> <userid> <groupid>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
USER_NAME="$1"
|
||||||
|
USER_ID="${2:-1000}" # Default to 1000 if not provided
|
||||||
|
GROUP_ID="${3:-1000}" # Default to 1000 if not provided
|
||||||
|
|
||||||
|
# Check if the group exists, create if it doesn't
|
||||||
|
if ! getent group "$USER_NAME" >/dev/null 2>&1; then
|
||||||
|
groupadd -g "$GROUP_ID" "$USER_NAME"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if the user exists, create if it doesn't
|
||||||
|
if ! id -u "$USER_NAME" >/dev/null 2>&1; then
|
||||||
|
useradd -u "$USER_ID" -g "$GROUP_ID" -d /home/"$USER_NAME" -s /bin/bash "$USER_NAME"
|
||||||
|
fi
|
||||||
|
USER="$USER_NAME"
|
||||||
|
# Set the user.
|
||||||
|
exec setpriv --reuid "$USER_ID" --regid "$GROUP_ID" --init-groups -- /bin/sh -c "$0"
|
||||||
Loading…
x
Reference in New Issue
Block a user