update container to build from source and copy in addons

This commit is contained in:
Vivian Lim 2020-09-06 17:32:42 -07:00
parent 207f047ef5
commit dc14fdf231
5 changed files with 33 additions and 20 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
addons/*
!addons/.placeholder
config/*
!config/.placeholder

View File

@ -1,26 +1,32 @@
FROM ubuntu:18.04
FROM alpine:3.12
# Install required software and srb2kart
RUN apt update && apt install -y software-properties-common
RUN add-apt-repository -y ppa:kartkrew/srb2kart && apt update && apt install -y srb2kart
RUN apk add --no-cache build-base make cmake wget git gcc tar zlib zlib-dev curl curl-dev sdl2-dev
# Setup volumes
VOLUME /config
VOLUME /addons
VOLUME /data
# clone (my patched) sources
RUN git clone https://github.com/vivlim/Kart-Public.git
WORKDIR /Kart-Public
RUN wget -qO- http://ppa.launchpad.net/kartkrew/srb2kart/ubuntu/pool/main/s/srb2kart-data/srb2kart-data_1.2-20200512035013.tar.xz | tar xJ
RUN sed -i 's%midi_disabled = digital_disabled = true;%digital_disabled = true;%' src/sdl/sdl_sound.c
RUN apk add --no-cache build-base
RUN cmake -B_build -DSRB2_CONFIG_HWRENDER=OFF -DSRB2_CONFIG_SDL2_USEMIXER=OFF -DSRB2_CONFIG_STATIC_OPENGL=OFF -DSRB2_CONFIG_USEASM=OFF -DSRB2_CONFIG_YASM=OFF -DSRB2_CONFIG_HAVE_GME=OFF -DSRB2_CONFIG_HAVE_PNG=OFF
RUN make -j`nproc` -C_build
# Symlink for config
RUN ln -sf /config/kartserv.cfg /usr/games/SRB2Kart/kartserv.cfg && ln -sf /addons /usr/games/SRB2Kart/addons
RUN ln -sf /config/kartserv.cfg /Kart-Public/kartserv.cfg && ln -sf /addons /Kart-Public/addons
# Expose network port
EXPOSE 5029/udp
# Copy bash script and fix execute permission
COPY srb2kart.sh /usr/bin/srb2kart.sh
RUN chmod a+x /usr/bin/srb2kart.sh
# Set working directory
WORKDIR /usr/games/SRB2Kart
COPY srb2kart.sh /srb2kart.sh
RUN chmod a+x /srb2kart.sh
# Run script
ENTRYPOINT ["srb2kart.sh"]
ENTRYPOINT ["/srb2kart.sh"]

0
addons/.placeholder Normal file
View File

0
config/.placeholder Normal file
View File

View File

@ -1,13 +1,16 @@
#!/bin/bash
#!/bin/sh
cd /usr/games/SRB2Kart || exit
EXTRA_FILES="$(ls /addons/*.kart) $(ls /addons/*.pk3)"
INITIAL_MAP=map11
ADDONS=$(ls /addons)
mkdir -p /assets
if [ -z "$ADDONS" ]; then
/usr/games/SRB2Kart/srb2kart -dedicated -config kartserv.cfg -home /data -file bonuschars.kart$*
exit
fi
echo "Copying base assets to /wads"
cp -rv /Kart-Public/assets/installer/* /assets
# Intentional word splitting
/usr/games/SRB2Kart/srb2kart -dedicated -config kartserv.cfg -home /data $* -file $ADDONS -file bonuschars.kart
echo "Copying addons over base assets"
cp -rv /addons/* /assets
echo "Launching with extra assets: bonuschars.kart $EXTRA_FILES"
SRB2WADDIR=/assets /Kart-Public/_build/bin/srb2kart -dedicated -config /config/kartserv.cfg -home /data -file bonuschars.kart $EXTRA_FILES +map $INITIAL_MAP