Skip to content

Commit

Permalink
Allow setting default non-root user and group
Browse files Browse the repository at this point in the history
  • Loading branch information
bubylou committed Jan 7, 2025
1 parent f862766 commit 0a5f870
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
37 changes: 21 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM debian:12.8-slim

ENV USER=steam
ENV PUID=1000
LABEL org.opencontainers.image.source="https://github.com/bubylou/steamcmd-docker" \
org.opencontainers.image.authors="Nicholas Malcolm <[email protected]>" \
org.opencontainers.image.licenses="MIT"

# Install SteamCMD from nonfree i386 repo
ARG DEBIAN_FRONTEND=noninteractive
Expand All @@ -12,16 +12,16 @@ RUN dpkg --add-architecture i386 \
&& echo steam steam/question select "I AGREE" | debconf-set-selections \
&& echo steam steam/license note '' | debconf-set-selections \
&& apt-get install -y --no-install-recommends ca-certificates locales steamcmd \
wget procps ncat
wget procps ncat \
&& ln -s /usr/games/steamcmd /usr/bin/steamcmd

ARG RELEASE="default"
# Install Wine and xvfb for fake display
RUN if [ "$RELEASE" = "wine" ]; then apt-get install -y --no-install-recommends \
RUN if [ "${RELEASE}" = "wine" ]; then apt-get install -y --no-install-recommends \
wine wine32 wine64 libwine libwine:i386 cabextract fonts-wine winbind xauth xvfb \
&& rm -rf /var/lib/apt/lists/*; fi

# Install winetricks for configuring wine
RUN if [ "$RELEASE" = "wine" ]; then wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks \
&& rm -rf /var/lib/apt/lists/* \
# Install winetricks for configuring wine prefix and installing dependencies
&& wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks \
&& chmod +x winetricks \
&& mv -v winetricks /usr/local/bin; fi

Expand All @@ -30,13 +30,18 @@ RUN locale-gen en_US.UTF-8
ENV LANG='en_US.UTF-8' \
LANGUAGE='en_US:en'

# Create inital user and directories
RUN ln -s /usr/games/steamcmd /usr/bin/steamcmd \
&& mkdir /app /config /data \
&& useradd -u $PUID -m $USER \
&& chown $USER:$USER -R /app /config /data

USER steam
# Default non-root user and group
ENV USER=steam \
GROUP=users \
PUID=1000 \
PGID=1000

# Create inital user, group, and directories
RUN mkdir /app /config /data \
&& groupmod -g ${PGID} ${GROUP} \
&& useradd -u ${PUID} -m ${USER} \
&& chown ${USER}:${GROUP} -R /app /config /data
USER ${USER}

# Update SteamCMD
RUN steamcmd +quit \
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ docker run -it bubylou/steamcmd:latest +login anonymous +app_update 4020 +quit
### Build image
```shell
docker buildx bake
```


## Wine Build
Expand Down

0 comments on commit 0a5f870

Please sign in to comment.