Skip to content

Commit

Permalink
better Dockerfile layering for enhance caching work
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyShorokhov committed Apr 4, 2024
1 parent 1320b63 commit b7bf2ee
Showing 1 changed file with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
ARG APPID="90"
ARG MOD="valve"

FROM debian:trixie-slim AS build_stage

ARG APPID
ARG MOD
ARG APPBRANCH=""

LABEL creator="Sergey Shorokhov <[email protected]>"

# Install required packages
Expand All @@ -28,14 +21,31 @@ WORKDIR ${APPDIR}

COPY --chmod=755 utils/* utils/

# Download mod depots
RUN DEPOTS=$(utils/getDepotsByMod.sh ${MOD}) \
&& for depot in ${DEPOTS}; do \
ARG APPID=90
ARG APPBRANCH="public"

ENV BASE_DEPOTS="1 4 1006"

# Download base depots
RUN for depot in ${BASE_DEPOTS}; do \
DepotDownloader -dir ${APPDIR} -app ${APPID} -depot ${depot} -beta ${APPBRANCH}; \
done
done

SHELL [ "/bin/bash", "-c" ]
ARG MOD="valve"

# Download mod depots
RUN MOD_DEPOTS=$(utils/getDepotsByMod.sh ${MOD}) \
&& MOD_DEPOTS=${MOD_DEPOTS//$BASE_DEPOTS/} && \
if [ -n "$MOD_DEPOTS" ]; then \
for depot in $MOD_DEPOTS; do \
DepotDownloader -dir ${APPDIR} -app ${APPID} -depot ${depot} -beta ${APPBRANCH}; \
done; \
fi

# Fix first run crash and STEAM Validation rejected issue
RUN cp ${APPDIR}/${MOD}/steam_appid.txt ${APPDIR}
RUN cp ${APPDIR}/${MOD}/steam_appid.txt ${APPDIR} \
&& touch ${APPDIR}/${MOD}/{banned,listip}.cfg

# Remove unnecessary files
RUN rm -rf linux64 .DepotDownloader utils/ \
Expand Down Expand Up @@ -74,10 +84,10 @@ RUN mkdir -p ${HOME}/.steam/sdk32/ \

EXPOSE 26900-27020/udp

WORKDIR /home/${APPUSER}/${APPDIRNAME}

ARG MOD
ENV MOD=${MOD}

WORKDIR /home/${APPUSER}/${APPDIRNAME}

# Set default command
CMD ["bash", "-c", "./hlds_run -game ${MOD} +ip 0.0.0.0 -port 27016 +map $(head -n 1 ./${MOD}/mapcycle.txt)"]

0 comments on commit b7bf2ee

Please sign in to comment.