Commit 07b3b6ce authored by Manuel Moos's avatar Manuel Moos
Browse files

Add docker ARGs for program name and title

Use progname everywhere, streamline layers a bit
parent cb911c55
Pipeline #239290068 passed with stages
in 32 minutes and 7 seconds
ARG BASE_ALPINE=amd64/alpine:3.12
ARG CONFIGURE_ARGS=""
ARG FAKERELEASE=false
ARG PROGNAME="armagetronad"
ARG PROGTITLE="Armagetron Advanced"
########################################
......@@ -8,6 +10,8 @@ ARG FAKERELEASE=false
FROM ${BASE_ALPINE} AS runtime_base
LABEL maintainer="Manuel Moos <z-man@users.sf.net>"
ARG PROGNAME
RUN apk add \
bash \
libxml2 \
......@@ -20,16 +24,13 @@ libstdc++ \
# protobuf \
WORKDIR /
RUN adduser -D armagetronad
RUN adduser -D ${PROGNAME}
########################################
# development prerequisites
FROM runtime_base AS builder
RUN mkdir src && wget https://forums3.armagetronad.net/download/file.php?id=9628 -O src/zthread.patch.bz2
RUN wget https://sourceforge.net/projects/zthread/files/ZThread/2.3.2/ZThread-2.3.2.tar.gz/download -O src/zthread.tgz
# build dependencies
RUN apk add \
autoconf \
......@@ -48,7 +49,10 @@ python3 \
#boost-dev \
#boost-thread \
RUN cd src && tar -xzf zthread.tgz && cd ZThread* && bzcat ../zthread.patch.bz2 | patch -p 1 && \
# download, patch, configure, build, install ZThread and remove all source traces in a single layer
RUN mkdir src && wget https://forums3.armagetronad.net/download/file.php?id=9628 -O src/zthread.patch.bz2 && \
wget https://sourceforge.net/projects/zthread/files/ZThread/2.3.2/ZThread-2.3.2.tar.gz/download -O src/zthread.tgz && \
cd src && tar -xzf zthread.tgz && cd ZThread* && bzcat ../zthread.patch.bz2 | patch -p 1 && \
CXXFLAGS="-fpermissive -DPTHREAD_MUTEX_RECURSIVE_NP=PTHREAD_MUTEX_RECURSIVE" ./configure --prefix=/usr --enable-shared=yes --enable-static=no && \
make -j `nproc` && \
make install && \
......@@ -61,12 +65,13 @@ cd ../../ && rm -r src
# build
FROM builder as build
ENV SOURCE_DIR /root/armagetronad
ENV BUILD_DIR /root/build
ARG CONFIGURE_ARGS
ARG FAKERELEASE
ARG BRANCH
ARG PROGNAME
ARG PROGTITLE
ENV SOURCE_DIR /root/${PROGNAME}
ENV BUILD_DIR /root/build
COPY . ${SOURCE_DIR}
WORKDIR ${SOURCE_DIR}
......@@ -75,8 +80,10 @@ RUN (test -r configure && test -f missing) || (./bootstrap.sh && cat version.m4)
RUN mkdir -p ${BUILD_DIR} && chmod 755 ${BUILD_DIR}
WORKDIR ${BUILD_DIR}
RUN ARMAGETRONAD_FAKERELEASE=${FAKERELEASE} \
${SOURCE_DIR}/configure --prefix=/usr/local --disable-glout --disable-sysinstall --disable-useradd --disable-master --disable-uninstall --disable-desktop ${CONFIGURE_ARGS} && \
RUN ARMAGETRONAD_FAKERELEASE=${FAKERELEASE} progname="${PROGNAME}" progtitle="${PROGTITLE}" \
${SOURCE_DIR}/configure --prefix=/usr/local --disable-glout --disable-sysinstall --disable-useradd \
--disable-master --disable-uninstall --disable-desktop \
${CONFIGURE_ARGS} && \
make -j `nproc` && \
DESTDIR=/root/destdir make install && \
rm -rf ${SOURCE_DIR} ${BUILD_DIR}
......@@ -91,10 +98,14 @@ COPY --chown=root --from=builder /usr/lib/*ZThread*.so* /usr/lib/
# pack
FROM runtime AS run_server
ARG PROGNAME
COPY --chown=root --from=build /root/destdir /
RUN sh /usr/local/share/games/*-dedicated/scripts/sysinstall install /usr/local
RUN sh /usr/local/share/games/*-dedicated/scripts/sysinstall install /usr/local && \
echo -e "#!/bin/bash\n/usr/local/bin/${PROGNAME}-dedicated \"\$@\"" > /usr/local/bin/run.sh && \
chmod 755 /usr/local/bin/run.sh
USER armagetronad
USER ${PROGNAME}
ENTRYPOINT /usr/local/bin/armagetronad-dedicated
ENTRYPOINT ["/usr/local/bin/run.sh"]
EXPOSE 4534/udp
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment