mirror of
https://github.com/AsgardEternal/SquadJSDocker.git
synced 2024-12-30 15:19:18 -06:00
Price Hiller
5d4651c168
We have to wait until the Squad server is initialized and has a full RCON connection up. This allows SquadJS to be started in tandem with a Squad docker image in docker compose without conflict. This is a bit hacky and a healthcheck would be superior, but there's a lot of instances to check in the Squad log to even verify if the RCON connection is good to go. Another potential way of doing this health check is to attempt to login into the rcon connection ourselves in a loop and then start SquadJS once that rcon connection succeeds (after closing the RCON connection we made).
49 lines
1.1 KiB
Docker
49 lines
1.1 KiB
Docker
# syntax=docker/dockerfile:1.4
|
|
|
|
# hadolint global ignore=DL3003,DL3008
|
|
|
|
FROM debian:bullseye-slim AS setup
|
|
|
|
ARG squadjs_version="3.6.1"
|
|
|
|
ENV USER="squadjs"
|
|
ENV USER_HOME="/home/${USER}"
|
|
ENV SQUADJS_DIR="${USER_HOME}/SquadJS/"
|
|
|
|
COPY --chown=root:root --chmod=0744 ./scripts/prepare-node14-yarn.bash /root/prepare-node14-yarn.bash
|
|
SHELL [ "/bin/bash", "-c" ]
|
|
|
|
RUN <<__EOR__
|
|
printf "Creating user\n"
|
|
useradd -m "${USER}"
|
|
|
|
printf "Installing Prereqs\n"
|
|
/root/prepare-node14-yarn.bash
|
|
apt-get update
|
|
apt-get install -y --no-install-suggests --no-install-recommends \
|
|
yarn \
|
|
nodejs \
|
|
git=1:2.30.2-1 \
|
|
sqlite3=3.34.1-3
|
|
|
|
su "${USER}" - <<- __EOC__
|
|
(
|
|
git clone --depth 1 --branch "v${squadjs_version}" https://github.com/Team-Silver-Sphere/SquadJS.git "${USER_HOME}/SquadJS"
|
|
cd "${USER_HOME}/SquadJS" || exit 1
|
|
yarn install
|
|
yarn cache clean
|
|
)
|
|
__EOC__
|
|
|
|
apt-get remove git yarn
|
|
rm -rf /var/lib/apt/lists/* /root/prepare-node14-yarn.bash
|
|
|
|
__EOR__
|
|
|
|
FROM setup as prod
|
|
|
|
USER "${USER}"
|
|
WORKDIR "${USER_HOME}/SquadJS"
|
|
COPY ./scripts/entry.sh .
|
|
ENTRYPOINT ["/bin/sh", "entry.sh"]
|