Swapped to debian and fixing user issues.
This commit is contained in:
parent
bf552562bb
commit
e01fdee37f
2 changed files with 24 additions and 19 deletions
28
Dockerfile
28
Dockerfile
|
|
@ -1,4 +1,4 @@
|
||||||
FROM steamcmd/steamcmd:latest
|
FROM steamcmd/steamcmd:debian
|
||||||
|
|
||||||
ENV PORT=7777
|
ENV PORT=7777
|
||||||
ENV UID=1000
|
ENV UID=1000
|
||||||
|
|
@ -16,18 +16,26 @@ RUN mkdir -p ${INSTALL_DIR} ${SERVER_DIR} ${CONFIG_DIR}
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y libicu-dev
|
apt-get install -y libicu-dev
|
||||||
|
|
||||||
# Create a new group and user using groupadd/useradd instead of addgroup/adduser
|
|
||||||
RUN groupadd --gid $GID steam && \
|
|
||||||
useradd --disabled-password --gecos '' --uid $UID --gid $GID steam
|
|
||||||
|
|
||||||
COPY start.sh $INSTALL_DIR/start.sh
|
|
||||||
# COPY config_gameplay.txt $CONFIGS/config_gameplay.txt
|
# COPY config_gameplay.txt $CONFIGS/config_gameplay.txt
|
||||||
# COPY config_remoteadmin.txt $CONFIGS/config_remoteadmin.txt
|
# COPY config_remoteadmin.txt $CONFIGS/config_remoteadmin.txt
|
||||||
# COPY config_localadmin_global.txt $CONFIGS/../config_localadmin_global.txt
|
# COPY config_localadmin_global.txt $CONFIGS/../config_localadmin_global.txt
|
||||||
# COPY localadmin_internal_data.json $CONFIGS/../localadmin_internal_data.json
|
# COPY localadmin_internal_data.json $CONFIGS/../localadmin_internal_data.json
|
||||||
|
|
||||||
# Change ownership of directories and set the start script as executable
|
# Create steam user and group
|
||||||
RUN chown $UID:$GID -R ${STEAM_DIR} ${INSTALL_DIR} ${SERVER_DIR} ${CONFIG_DIR} && \
|
RUN groupadd --gid $GID steam && \
|
||||||
chmod +x ${INSTALL_DIR}/start.sh
|
useradd --create-home -c 'Steam User' -l --uid $UID --gid $GID --home-dir $INSTALL_DIR steam && \
|
||||||
|
chown -R steam:steam ${INSTALL_DIR}
|
||||||
|
|
||||||
ENTRYPOINT /bin/sh ${INSTALL_DIR}/start.sh
|
# Copy and prepare start script
|
||||||
|
COPY start.sh $INSTALL_DIR/start.sh
|
||||||
|
RUN chmod +x ${INSTALL_DIR}/start.sh && \
|
||||||
|
chown steam:steam ${INSTALL_DIR}/start.sh
|
||||||
|
|
||||||
|
# Switch to steam user
|
||||||
|
USER steam
|
||||||
|
WORKDIR $INSTALL_DIR
|
||||||
|
|
||||||
|
# Set HOME environment variable to INSTALL_DIR to force steamcmd to use it
|
||||||
|
ENV HOME=$INSTALL_DIR
|
||||||
|
|
||||||
|
ENTRYPOINT ["/bin/sh", "start.sh"]
|
||||||
15
start.sh
15
start.sh
|
|
@ -4,14 +4,11 @@ echo "Current user is: $(whoami)"
|
||||||
# Install/update SCP:SL server
|
# Install/update SCP:SL server
|
||||||
steamcmd +force_install_dir $SERVER_DIR +login anonymous +app_update 996560 validate +quit
|
steamcmd +force_install_dir $SERVER_DIR +login anonymous +app_update 996560 validate +quit
|
||||||
|
|
||||||
# Ensure proper ownership
|
# # Define config directory path
|
||||||
chown -R steam:steam $INSTALL_DIR
|
# CONFIGS="$INSTALL_DIR/.config/SCP Secret Laboratory/config/$PORT"
|
||||||
|
|
||||||
# Define config directory path
|
# # Ensure config directory exists
|
||||||
CONFIGS="$INSTALL_DIR/.config/SCP Secret Laboratory/config/$PORT"
|
# mkdir -p "$CONFIGS"
|
||||||
|
|
||||||
# Ensure config directory exists
|
# Run server directly (no need to su)
|
||||||
mkdir -p "$CONFIGS"
|
cd $SERVER_DIR && HOME=$INSTALL_DIR ./LocalAdmin $PORT #--config "$CONFIGS"
|
||||||
|
|
||||||
# Switch to steam user and run server
|
|
||||||
su - steam -c "cd $SERVER_DIR && HOME=$INSTALL_DIR ./LocalAdmin $PORT --config \"$CONFIGS\""
|
|
||||||
Loading…
Reference in a new issue