moved to multi multi stage build
docker ci executing hook with always pull before build. Therefore e.g. first image is created but right after overwritten by previous image.
This commit is contained in:
parent
78cb47c317
commit
2d702db907
@ -1,6 +1,73 @@
|
||||
ARG SUFFIX=""
|
||||
FROM debian:buster-slim as lgsm
|
||||
|
||||
FROM jusito/docker-ttt:lgsm_debian${SUFFIX}
|
||||
# Const \\ Overwrite Env \\ Configs possible \\ Configs needed
|
||||
# C.UTF-8 -> en_US.UTF-8
|
||||
ENV STEAM_PATH="/home/steam" \
|
||||
SERVER_PATH="/home/steam/serverfiles" \
|
||||
STEAM_CMD="/home/steam/.steam/steamcmd" \
|
||||
GROUP_ID=10000 \
|
||||
USER_ID=10000 \
|
||||
DOCKER_USER=steam \
|
||||
SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.1.9/supercronic-linux-amd64 \
|
||||
SUPERCRONIC=supercronic-linux-amd64 \
|
||||
SUPERCRONIC_SHA1SUM=5ddf8ea26b56d4a7ff6faecdd8966610d5cb9d85 \
|
||||
\
|
||||
\
|
||||
DEBIAN_FRONTEND=noninteractive \
|
||||
LANG=C.UTF-8 \
|
||||
TERM=xterm \
|
||||
\
|
||||
\
|
||||
DEBUGGING=false \
|
||||
CRON_MONITOR="*/5 * * * *" \
|
||||
CRON_UPDATE="*/30 * * * *" \
|
||||
CRON_FORCE_UPDATE="0 10 * * 0" \
|
||||
CRON_LOG_ROTATE="0 0 * * 0" \
|
||||
\
|
||||
\
|
||||
SERVER_EXECUTABLE="" \
|
||||
SERVER_GAME="" \
|
||||
TZ="Europe/Berlin"
|
||||
#https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
||||
|
||||
ENTRYPOINT ["./home/entrypoint.sh"]
|
||||
|
||||
#WORKDIR "$STEAM_PATH"
|
||||
|
||||
COPY ["lgsm/entrypoint.sh", "lgsm/initCron.sh", "lgsm/createAlias.sh", "/home/"]
|
||||
|
||||
# procps needed for ps command
|
||||
# iproute2 needed because of "-slim"
|
||||
RUN dpkg --add-architecture i386 && \
|
||||
apt-get update -y && \
|
||||
apt-get install -y mailutils postfix curl wget file tar bzip2 gzip unzip bsdmainutils python util-linux ca-certificates \
|
||||
binutils bc jq tmux lib32gcc1 libstdc++6 lib32stdc++6 libtinfo5:i386 netcat libsdl2-2.0-0:i386 \
|
||||
procps iproute2 && \
|
||||
\
|
||||
groupadd -g $GROUP_ID $DOCKER_USER && \
|
||||
useradd -d "$STEAM_PATH" -g $GROUP_ID -u $USER_ID -m $DOCKER_USER && \
|
||||
chown "$DOCKER_USER:$DOCKER_USER" /home/entrypoint.sh && \
|
||||
chown "$DOCKER_USER:$DOCKER_USER" /home/initCron.sh && \
|
||||
mkdir -p "$SERVER_PATH" && \
|
||||
chown -R "$DOCKER_USER:$DOCKER_USER" "$STEAM_PATH" && \
|
||||
chmod a=rx /home/entrypoint.sh && \
|
||||
chmod a=rx /home/initCron.sh && \
|
||||
chmod a=rx /home/createAlias.sh && \
|
||||
\
|
||||
ulimit -n 2048 && \
|
||||
\
|
||||
wget -O "$STEAM_PATH/linuxgsm.sh" "https://linuxgsm.sh" && \
|
||||
chown "$DOCKER_USER:$DOCKER_USER" "$STEAM_PATH/linuxgsm.sh" && \
|
||||
chmod +x "$STEAM_PATH/linuxgsm.sh" && \
|
||||
\
|
||||
\
|
||||
wget -O "${SUPERCRONIC}" "$SUPERCRONIC_URL" && \
|
||||
echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - && \
|
||||
chmod +x "$SUPERCRONIC" && \
|
||||
mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" && \
|
||||
ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic
|
||||
|
||||
FROM lgsm as gmod
|
||||
|
||||
# Const \\ Overwrite Env \\ Configs optional
|
||||
ENV CSS_PATH="/home/steam/addons/css" \
|
||||
@ -74,7 +141,7 @@ ENV CSS_PATH="/home/steam/addons/css" \
|
||||
USE_MY_REPLACER_CONFIG=false
|
||||
|
||||
|
||||
COPY ["prepareServer.sh", "initConfig.sh", "forceWorkshopDownload.sh", "installAndMountAddons.sh", "common.cfg", "/home/"]
|
||||
COPY ["gmod/prepareServer.sh", "gmod/initConfig.sh", "gmod/forceWorkshopDownload.sh", "gmod/installAndMountAddons.sh", "gmod/common.cfg", "/home/"]
|
||||
|
||||
RUN chown "$DOCKER_USER:$DOCKER_USER" /home/prepareServer.sh && \
|
||||
chown "$DOCKER_USER:$DOCKER_USER" /home/initConfig.sh && \
|
||||
@ -100,3 +167,13 @@ RUN chown "$DOCKER_USER:$DOCKER_USER" /home/prepareServer.sh && \
|
||||
/home/createAlias.sh "update" '/home/steam/gmodserver update' && \
|
||||
/home/createAlias.sh "update-lgsm" '/home/steam/gmodserver update-lgsm' && \
|
||||
/home/createAlias.sh "validate" '/home/steam/gmodserver validate'
|
||||
|
||||
FROM gmod as TTT
|
||||
|
||||
ENV SERVER_GAMEMODE="terrortown"
|
||||
|
||||
COPY "TTT/server.cfg.default" "/home/server.cfg.default"
|
||||
|
||||
USER "$USER_ID:$GROUP_ID"
|
||||
|
||||
VOLUME "$SERVER_PATH"
|
21
docker-compose.yml
Normal file
21
docker-compose.yml
Normal file
@ -0,0 +1,21 @@
|
||||
volumes:
|
||||
TTTDev:
|
||||
|
||||
services:
|
||||
ttt:
|
||||
build: .
|
||||
ports:
|
||||
- 27015:27015/tcp
|
||||
- 27015:27015/udp
|
||||
environment:
|
||||
INSTALL_CSS: "true"
|
||||
SERVER_DEFAULT_MAP: ttt_lttp_kakariko_a4
|
||||
SERVER_PORT: 27015
|
||||
SERVER_NAME: "Example Name"
|
||||
SERVER_PASSWORD: securePassword
|
||||
SERVER_VOICE_ENABLE: 0
|
||||
SERVER_MAX_PLAYERS: 20
|
||||
SERVER_RCON_PASSWORD: securePassword
|
||||
WORKSHOP_COLLECTION_ID: 1895900191
|
||||
volumes:
|
||||
- TTTDev:/home/steam/serverfiles
|
13
hooks/pre_push
Normal file
13
hooks/pre_push
Normal file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
|
||||
imageSuffix=""
|
||||
if [ "$SOURCE_BRANCH" != "master" ]; then
|
||||
imageSuffix="-$(echo "$SOURCE_BRANCH" | sed 's/\//-/g')"
|
||||
fi
|
||||
|
||||
cd ..
|
||||
|
||||
bash test/testBuild.sh "$imageSuffix" --skip-ttt --push
|
@ -1,69 +0,0 @@
|
||||
FROM debian:buster-slim
|
||||
|
||||
# Const \\ Overwrite Env \\ Configs possible \\ Configs needed
|
||||
# C.UTF-8 -> en_US.UTF-8
|
||||
ENV STEAM_PATH="/home/steam" \
|
||||
SERVER_PATH="/home/steam/serverfiles" \
|
||||
STEAM_CMD="/home/steam/.steam/steamcmd" \
|
||||
GROUP_ID=10000 \
|
||||
USER_ID=10000 \
|
||||
DOCKER_USER=steam \
|
||||
SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.1.9/supercronic-linux-amd64 \
|
||||
SUPERCRONIC=supercronic-linux-amd64 \
|
||||
SUPERCRONIC_SHA1SUM=5ddf8ea26b56d4a7ff6faecdd8966610d5cb9d85 \
|
||||
\
|
||||
\
|
||||
DEBIAN_FRONTEND=noninteractive \
|
||||
LANG=C.UTF-8 \
|
||||
TERM=xterm \
|
||||
\
|
||||
\
|
||||
DEBUGGING=false \
|
||||
CRON_MONITOR="*/5 * * * *" \
|
||||
CRON_UPDATE="*/30 * * * *" \
|
||||
CRON_FORCE_UPDATE="0 10 * * 0" \
|
||||
CRON_LOG_ROTATE="0 0 * * 0" \
|
||||
\
|
||||
\
|
||||
SERVER_EXECUTABLE="" \
|
||||
SERVER_GAME="" \
|
||||
TZ="Europe/Berlin"
|
||||
#https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
||||
|
||||
ENTRYPOINT ["./home/entrypoint.sh"]
|
||||
|
||||
#WORKDIR "$STEAM_PATH"
|
||||
|
||||
COPY ["entrypoint.sh", "initCron.sh", "createAlias.sh", "/home/"]
|
||||
|
||||
# procps needed for ps command
|
||||
# iproute2 needed because of "-slim"
|
||||
RUN dpkg --add-architecture i386 && \
|
||||
apt-get update -y && \
|
||||
apt-get install -y mailutils postfix curl wget file tar bzip2 gzip unzip bsdmainutils python util-linux ca-certificates \
|
||||
binutils bc jq tmux lib32gcc1 libstdc++6 lib32stdc++6 libtinfo5:i386 netcat libsdl2-2.0-0:i386 \
|
||||
procps iproute2 && \
|
||||
\
|
||||
groupadd -g $GROUP_ID $DOCKER_USER && \
|
||||
useradd -d "$STEAM_PATH" -g $GROUP_ID -u $USER_ID -m $DOCKER_USER && \
|
||||
chown "$DOCKER_USER:$DOCKER_USER" /home/entrypoint.sh && \
|
||||
chown "$DOCKER_USER:$DOCKER_USER" /home/initCron.sh && \
|
||||
mkdir -p "$SERVER_PATH" && \
|
||||
chown -R "$DOCKER_USER:$DOCKER_USER" "$STEAM_PATH" && \
|
||||
chmod a=rx /home/entrypoint.sh && \
|
||||
chmod a=rx /home/initCron.sh && \
|
||||
chmod a=rx /home/createAlias.sh && \
|
||||
\
|
||||
ulimit -n 2048 && \
|
||||
\
|
||||
wget -O "$STEAM_PATH/linuxgsm.sh" "https://linuxgsm.sh" && \
|
||||
chown "$DOCKER_USER:$DOCKER_USER" "$STEAM_PATH/linuxgsm.sh" && \
|
||||
chmod +x "$STEAM_PATH/linuxgsm.sh" && \
|
||||
\
|
||||
\
|
||||
wget -O "${SUPERCRONIC}" "$SUPERCRONIC_URL" && \
|
||||
echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - && \
|
||||
chmod +x "$SUPERCRONIC" && \
|
||||
mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" && \
|
||||
ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
readonly SUFFIX="$1"
|
||||
readonly BUILD_LGSM="$(grep -qF -e '--skip-lgsm' <<< "$@" && echo false || echo true)"
|
||||
readonly BUILD_TTT="$(grep -qF -e '--skip-ttt' <<< "$@" && echo false || echo true)"
|
||||
readonly PUSH="$(grep -qF -e '--push' <<< "$@" && echo true || echo false)"
|
||||
readonly repository="${DOCKER_REPO:-jusito/docker-ttt}"
|
||||
|
||||
@ -18,9 +18,10 @@ set -o pipefail
|
||||
function process() {
|
||||
tag_prefix="$1"
|
||||
subdir="$2"
|
||||
cache_option="$(grep -qF -e '--no-cache' <<< "$@" && echo "--no-cache" || echo "")"
|
||||
|
||||
docker rmi "$repository:$tag_prefix${SUFFIX}" || true
|
||||
docker build --no-cache -t "$repository:$tag_prefix${SUFFIX}" "$subdir"
|
||||
docker build --target "$subdir" $cache_option -t "$repository:$tag_prefix${SUFFIX}" "$subdir/"
|
||||
if "$PUSH"; then
|
||||
docker push "$repository:$tag_prefix${SUFFIX}"
|
||||
fi
|
||||
@ -28,16 +29,16 @@ function process() {
|
||||
|
||||
echo "[testBuild][INFO] build"
|
||||
|
||||
if "$BUILD_LGSM"; then
|
||||
process "lgsm_debian" "lgsm/"
|
||||
process "lgsm_debian" "lgsm" --no-cache
|
||||
process "gmod_debian" "gmod"
|
||||
if "$BUILD_TTT"; then
|
||||
process "gmod_ttt_debian" "TTT"
|
||||
fi
|
||||
process "gmod_debian" "gmod/"
|
||||
process "gmod_ttt_debian" "TTT/"
|
||||
|
||||
docker rmi "$repository:latest${SUFFIX}" || true
|
||||
docker tag "$repository:gmod_ttt_debian${SUFFIX}" "$repository:latest${SUFFIX}"
|
||||
if "$PUSH"; then
|
||||
docker push "$repository:lgsm_debian${SUFFIX}"
|
||||
docker push "$repository:latest${SUFFIX}"
|
||||
fi
|
||||
|
||||
echo "[testBuild][INFO] build done!"
|
||||
|
Loading…
Reference in New Issue
Block a user