Skip to content

Commit

Permalink
Merge pull request #107 from startersclan/enhancement/add-bf2stats-2.…
Browse files Browse the repository at this point in the history
…7.0-variants

Enhancement: Add bf2stats 2.7.0 variants
  • Loading branch information
leojonathanoh committed Dec 22, 2023
2 parents 1ffa788 + 5b9ec5d commit 7b3c000
Show file tree
Hide file tree
Showing 21 changed files with 3,538 additions and 6 deletions.
134 changes: 134 additions & 0 deletions .github/workflows/ci-master-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,73 @@ jobs:
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

# This step generates the docker tags
- name: Prepare
id: prep-v1-5-3153-0-bf2all64-bf2stats-2-7-0
run: |
set -e
# Get ref, i.e. <branch_name> from refs/heads/<branch_name>, or <tag-name> from refs/tags/<tag_name>. E.g. 'master' or 'v0.0.0'
REF=$( echo "${GITHUB_REF}" | rev | cut -d '/' -f 1 | rev )
# Get short commit hash E.g. 'abc0123'
SHA=$( echo "${GITHUB_SHA}" | cut -c1-7 )
# Generate docker image tags
# E.g. 'v0.0.0-<variant>' and 'v0.0.0-abc0123-<variant>'
# E.g. 'master-<variant>' and 'master-abc0123-<variant>'
VARIANT="v1.5.3153.0-bf2all64-bf2stats-2.7.0"
REF_VARIANT="${REF}-${VARIANT}"
REF_SHA_VARIANT="${REF}-${SHA}-${VARIANT}"
# Pass variables to next step
echo "VARIANT_BUILD_DIR=$VARIANT_BUILD_DIR" >> $GITHUB_OUTPUT
echo "VARIANT=$VARIANT" >> $GITHUB_OUTPUT
echo "REF_VARIANT=$REF_VARIANT" >> $GITHUB_OUTPUT
echo "REF_SHA_VARIANT=$REF_SHA_VARIANT" >> $GITHUB_OUTPUT
- name: v1.5.3153.0-bf2all64-bf2stats-2.7.0 - Build (PRs)
# Run only on pull requests
if: github.event_name == 'pull_request'
uses: docker/build-push-action@v3
with:
context: variants/v1.5.3153.0-bf2all64-bf2stats-2.7.0
platforms: linux/386,linux/amd64
push: false
tags: |
${{ github.repository }}:${{ steps.prep-v1-5-3153-0-bf2all64-bf2stats-2-7-0.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-v1-5-3153-0-bf2all64-bf2stats-2-7-0.outputs.REF_SHA_VARIANT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: v1.5.3153.0-bf2all64-bf2stats-2.7.0 - Build and push (master)
# Run only on master
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v3
with:
context: variants/v1.5.3153.0-bf2all64-bf2stats-2.7.0
platforms: linux/386,linux/amd64
push: true
tags: |
${{ github.repository }}:${{ steps.prep-v1-5-3153-0-bf2all64-bf2stats-2-7-0.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-v1-5-3153-0-bf2all64-bf2stats-2-7-0.outputs.REF_SHA_VARIANT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: v1.5.3153.0-bf2all64-bf2stats-2.7.0 - Build and push (release)
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v3
with:
context: variants/v1.5.3153.0-bf2all64-bf2stats-2.7.0
platforms: linux/386,linux/amd64
push: true
tags: |
${{ github.repository }}:${{ steps.prep-v1-5-3153-0-bf2all64-bf2stats-2-7-0.outputs.VARIANT }}
${{ github.repository }}:${{ steps.prep-v1-5-3153-0-bf2all64-bf2stats-2-7-0.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-v1-5-3153-0-bf2all64-bf2stats-2-7-0.outputs.REF_SHA_VARIANT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

# This step generates the docker tags
- name: Prepare
id: prep-v1-5-3153-0-bf2all64-bf2stats-3-1-0
Expand Down Expand Up @@ -1284,6 +1351,73 @@ jobs:
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

# This step generates the docker tags
- name: Prepare
id: prep-v1-5-3153-0-bf2stats-2-7-0
run: |
set -e
# Get ref, i.e. <branch_name> from refs/heads/<branch_name>, or <tag-name> from refs/tags/<tag_name>. E.g. 'master' or 'v0.0.0'
REF=$( echo "${GITHUB_REF}" | rev | cut -d '/' -f 1 | rev )
# Get short commit hash E.g. 'abc0123'
SHA=$( echo "${GITHUB_SHA}" | cut -c1-7 )
# Generate docker image tags
# E.g. 'v0.0.0-<variant>' and 'v0.0.0-abc0123-<variant>'
# E.g. 'master-<variant>' and 'master-abc0123-<variant>'
VARIANT="v1.5.3153.0-bf2stats-2.7.0"
REF_VARIANT="${REF}-${VARIANT}"
REF_SHA_VARIANT="${REF}-${SHA}-${VARIANT}"
# Pass variables to next step
echo "VARIANT_BUILD_DIR=$VARIANT_BUILD_DIR" >> $GITHUB_OUTPUT
echo "VARIANT=$VARIANT" >> $GITHUB_OUTPUT
echo "REF_VARIANT=$REF_VARIANT" >> $GITHUB_OUTPUT
echo "REF_SHA_VARIANT=$REF_SHA_VARIANT" >> $GITHUB_OUTPUT
- name: v1.5.3153.0-bf2stats-2.7.0 - Build (PRs)
# Run only on pull requests
if: github.event_name == 'pull_request'
uses: docker/build-push-action@v3
with:
context: variants/v1.5.3153.0-bf2stats-2.7.0
platforms: linux/386,linux/amd64
push: false
tags: |
${{ github.repository }}:${{ steps.prep-v1-5-3153-0-bf2stats-2-7-0.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-v1-5-3153-0-bf2stats-2-7-0.outputs.REF_SHA_VARIANT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: v1.5.3153.0-bf2stats-2.7.0 - Build and push (master)
# Run only on master
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v3
with:
context: variants/v1.5.3153.0-bf2stats-2.7.0
platforms: linux/386,linux/amd64
push: true
tags: |
${{ github.repository }}:${{ steps.prep-v1-5-3153-0-bf2stats-2-7-0.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-v1-5-3153-0-bf2stats-2-7-0.outputs.REF_SHA_VARIANT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: v1.5.3153.0-bf2stats-2.7.0 - Build and push (release)
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v3
with:
context: variants/v1.5.3153.0-bf2stats-2.7.0
platforms: linux/386,linux/amd64
push: true
tags: |
${{ github.repository }}:${{ steps.prep-v1-5-3153-0-bf2stats-2-7-0.outputs.VARIANT }}
${{ github.repository }}:${{ steps.prep-v1-5-3153-0-bf2stats-2-7-0.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-v1-5-3153-0-bf2stats-2-7-0.outputs.REF_SHA_VARIANT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

# This step generates the docker tags
- name: Prepare
id: prep-v1-5-3153-0-bf2stats-3-1-0
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ All images contain [`Battlefield 2 Server 1.50`](https://www.bf-games.net/downlo
| `:v1.5.3153.0-bf2all64-bf2stats-2.4.6` | [View](variants/v1.5.3153.0-bf2all64-bf2stats-2.4.6 ) |
| `:v1.5.3153.0-bf2all64-bf2stats-2.5.1` | [View](variants/v1.5.3153.0-bf2all64-bf2stats-2.5.1 ) |
| `:v1.5.3153.0-bf2all64-bf2stats-2.6.0` | [View](variants/v1.5.3153.0-bf2all64-bf2stats-2.6.0 ) |
| `:v1.5.3153.0-bf2all64-bf2stats-2.7.0` | [View](variants/v1.5.3153.0-bf2all64-bf2stats-2.7.0 ) |
| `:v1.5.3153.0-bf2all64-bf2stats-3.1.0` | [View](variants/v1.5.3153.0-bf2all64-bf2stats-3.1.0 ) |
| `:v1.5.3153.0-bf2all64-bf2stats-3.1.2` | [View](variants/v1.5.3153.0-bf2all64-bf2stats-3.1.2 ) |
| `:v1.5.3153.0-bf2all64-bf2stats-3.2.0` | [View](variants/v1.5.3153.0-bf2all64-bf2stats-3.2.0 ) |
Expand All @@ -30,6 +31,7 @@ All images contain [`Battlefield 2 Server 1.50`](https://www.bf-games.net/downlo
| `:v1.5.3153.0-bf2stats-2.4.6` | [View](variants/v1.5.3153.0-bf2stats-2.4.6 ) |
| `:v1.5.3153.0-bf2stats-2.5.1` | [View](variants/v1.5.3153.0-bf2stats-2.5.1 ) |
| `:v1.5.3153.0-bf2stats-2.6.0` | [View](variants/v1.5.3153.0-bf2stats-2.6.0 ) |
| `:v1.5.3153.0-bf2stats-2.7.0` | [View](variants/v1.5.3153.0-bf2stats-2.7.0 ) |
| `:v1.5.3153.0-bf2stats-3.1.0` | [View](variants/v1.5.3153.0-bf2stats-3.1.0 ) |
| `:v1.5.3153.0-bf2stats-3.1.2` | [View](variants/v1.5.3153.0-bf2stats-3.1.2 ) |
| `:v1.5.3153.0-bf2stats-3.2.0` | [View](variants/v1.5.3153.0-bf2stats-3.2.0 ) |
Expand Down
12 changes: 6 additions & 6 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ To customize the server, edit `serversettings.con` and `maplist.con` accordingly

```sh
# Generate serversettings.con and customize
docker run --rm startersclan/docker-bf2:v1.5.3153.0-bf2stats-2.6.0 cat /server/bf2/mods/bf2/settings/serversettings.con > serversettings.con
docker run --rm startersclan/docker-bf2:v1.5.3153.0-bf2stats-2.7.0 cat /server/bf2/mods/bf2/settings/serversettings.con > serversettings.con
# Generate maplist.con (coop)
docker run --rm startersclan/docker-bf2:v1.5.3153.0-bf2stats-2.6.0 bash -c '(esai-helper -m bf2 get maplist; esai-helper -m xpack get maplist) | grep gpm_coop' > maplist.con
docker run --rm startersclan/docker-bf2:v1.5.3153.0-bf2stats-2.7.0 bash -c '(esai-helper -m bf2 get maplist; esai-helper -m xpack get maplist) | grep gpm_coop' > maplist.con
# Generate maplist.con (conquest)
docker run --rm startersclan/docker-bf2:v1.5.3153.0-bf2stats-2.6.0 bash -c '(esai-helper -m bf2 get maplist; esai-helper -m xpack get maplist) | grep gpm_cq' > maplist.con
docker run --rm startersclan/docker-bf2:v1.5.3153.0-bf2stats-2.7.0 bash -c '(esai-helper -m bf2 get maplist; esai-helper -m xpack get maplist) | grep gpm_cq' > maplist.con
# Generate BF2StatisticsConfig.py and customize
docker run --rm startersclan/docker-bf2:v1.5.3153.0-bf2stats-2.6.0 cat /server/bf2/python/bf2/BF2StatisticsConfig.py > BF2StatisticsConfig.py
docker run --rm startersclan/docker-bf2:v1.5.3153.0-bf2stats-2.7.0 cat /server/bf2/python/bf2/BF2StatisticsConfig.py > BF2StatisticsConfig.py
# BF2 server with BF2Statistics 2.x.x
docker run --rm -it -p 16567:16567/udp -p 29900:29900/udp \
-v "$(pwd)/serversettings.con:/server/bf2/mods/bf2/settings/serversettings.con:ro" \
Expand All @@ -74,7 +74,7 @@ docker run --rm -it -p 16567:16567/udp -p 29900:29900/udp \
--add-host bf2web.gamespy.com:192.168.1.100 \
--add-host gamestats.gamespy.com:192.168.1.100 \
--add-host eapusher.dice.se:192.168.1.100 \
startersclan/docker-bf2:v1.5.3153.0-bf2stats-2.6.0
startersclan/docker-bf2:v1.5.3153.0-bf2stats-2.7.0
```

See `docker-compose` examples:
Expand Down Expand Up @@ -308,7 +308,7 @@ docker run --rm -it -p 16567:16567/udp -p 29900:29900/udp \
--add-host bf2web.gamespy.com:192.168.1.100 \
--add-host gamestats.gamespy.com:192.168.1.100 \
--add-host eapusher.dice.se:192.168.1.100 \
startersclan/docker-bf2:v1.5.3153.0-bf2stats-2.6.0
startersclan/docker-bf2:v1.5.3153.0-bf2stats-2.7.0
```

See `docker-compose` examples:
Expand Down
3 changes: 3 additions & 0 deletions generate/definitions/VARIANTS.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ $local:VARIANTS_MATRIX = @(
@{ components = @( 'bf2all64', 'bf2stats-2.4.6' ) }
@{ components = @( 'bf2all64', 'bf2stats-2.5.1' ) }
@{ components = @( 'bf2all64', 'bf2stats-2.6.0' ) }
@{ components = @( 'bf2all64', 'bf2stats-2.7.0' ) }
@{ components = @( 'bf2all64', 'bf2stats-3.1.0' ) }
@{ components = @( 'bf2all64', 'bf2stats-3.1.2' ) }
@{ components = @( 'bf2all64', 'bf2stats-3.2.0' ) }
Expand All @@ -22,6 +23,7 @@ $local:VARIANTS_MATRIX = @(
@{ components = @( 'bf2stats-2.4.6' ) }
@{ components = @( 'bf2stats-2.5.1' ) }
@{ components = @( 'bf2stats-2.6.0' ) }
@{ components = @( 'bf2stats-2.7.0' ) }
@{ components = @( 'bf2stats-3.1.0' ) }
@{ components = @( 'bf2stats-3.1.2' ) }
@{ components = @( 'bf2stats-3.2.0' ) }
Expand Down Expand Up @@ -82,6 +84,7 @@ b0a8b23841c5d3fac51650a6da8ff0e77c1d143a7aaf37c40c498077d71a2a2f 2.4.5.zip
8dc705319c03fc9083f41f2b988e8dba1d54f43d3dd518fae1e5cb6c9b38a110 2.5.0.zip
3d736d1990d452e5da3f24d7d0eb1091a85a286239b5667fab98518cb1c115c9 2.5.1.zip
6438d1f3a940fbb81c38b5b43aa73f077721a89bd4752da5d1e40bf214e7fc1e 2.6.0.zip
48b47519d16f33db4a13fcdeaa4e74b0b5f9a81eb9f193ca83c48657ed4b9f45 2.7.0.zip
"@
bf2stats_3_statspython_sha256sum = @"
ab6d0f2dc3c90223524a6d97dd3100796fdf266444b5cd2f066116b977d3551c 3.1.0.zip
Expand Down
99 changes: 99 additions & 0 deletions variants/v1.5.3153.0-bf2all64-bf2stats-2.7.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
FROM ubuntu:16.04 as install
ARG TARGETPLATFORM=linux/amd64
ARG BUILDPLATFORM=linux/amd64
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"

# Install network utilities which can be useful for debugging issues
# Install unzip and zip for the sake of applying ESAI strategies in ./mods/*/levels/*/server.zip at './GameModes/[gpm_coop|gpm_cq|sp1|sp2|sp3]/[16|32|64]/AI/Strategies.ai'
RUN export DEBIAN_FRONTEND=noninteractive; \
apt-get update; \
apt-get install --no-install-recommends -y \
ca-certificates \
curl \
conntrack dnsutils iproute2 netcat net-tools tcpdump \
unzip zip \
; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*;

# Install Battlefield 2 server
WORKDIR /root
COPY aibehaviours-fixlookatwrapper.ai /aibehaviours-fixlookatwrapper.ai
RUN set -eux; \
curl -sSLO https://files.startersclan.com/ea/bf2/bf2-linuxded-1.5.3153.0-installer.tgz; \
sha256sum bf2-linuxded-1.5.3153.0-installer.tgz | grep "^4d849218c1725e7bd6a7e7f164e27b036248f8ded2e30340dd0722c1dfffbab6 "; \
tar -zxvf bf2-linuxded-1.5.3153.0-installer.tgz; \
sh bf2-linuxded-1.5.3153.0-installer.sh --target /install --noexec --info; \
sh bf2-linuxded-1.5.3153.0-installer.sh --target /install --noexec; \
rm -v bf2-linuxded-1.5.3153.0-installer.sh; \
rm -v bf2-linuxded-1.5.3153.0-installer.tgz; \
cd /install; \
mkdir -p /server; \
# Show the licenses without a pager
cat /install/license.sh | sed 's/^more/cat/' > /install/license-fixed.sh; \
# Agree to licenses
printf '\naccept\n\nyes\n/server\ny\n' | sh /install/license-fixed.sh; \
find /server; \
rm -rf /install; \
# Apply the LookAtWrapper fix to prevent crashes when playing with bots
mv -v /server/bf2/mods/bf2/ai/aibehaviours.ai /server/bf2/mods/bf2/ai/aibehaviours.ai.original; \
cp -v /aibehaviours-fixlookatwrapper.ai /server/bf2/mods/bf2/ai/aibehaviours.ai; \
mv -v /server/bf2/mods/xpack/ai/aibehaviours.ai /server/bf2/mods/xpack/ai/aibehaviours.ai.original; \
cp -v /aibehaviours-fixlookatwrapper.ai /server/bf2/mods/xpack/ai/aibehaviours.ai; \
rm -v /aibehaviours-fixlookatwrapper.ai

# Install bf2all64 mod
WORKDIR /root
COPY aibehaviours-fixlookatwrapper.ai /aibehaviours-fixlookatwrapper.ai
RUN set -eux; \
curl -sSLO https://files.startersclan.com/ea/bf2/bf2all64_v1.0_setup.zip; \
sha256sum bf2all64_v1.0_setup.zip | grep '^4ee82d91043c4afbf1bed50787cbf98af124bd7e6c608cdb0f5115c7761024f1 '; \
unzip bf2all64_v1.0_setup.zip -d extract; \
rm -rf /server/bf2/mods/bf2all64; \
mv extract/bf2all64 /server/bf2/mods; \
rm -fv bf2all64_v1.0_setup.zip; \
# Apply the LookAtWrapper fix to prevent crashes when playing with bots
mv -v /server/bf2/mods/bf2all64/ai/aibehaviours.ai /server/bf2/mods/bf2all64/ai/aibehaviours.ai.original; \
cp -v /aibehaviours-fixlookatwrapper.ai /server/bf2/mods/bf2all64/ai/aibehaviours.ai; \
rm -v /aibehaviours-fixlookatwrapper.ai

# Install bf2stats 2.7.0
WORKDIR /root
RUN set -eux; \
curl -sSLO https://github.com/startersclan/bf2stats/archive/refs/tags/2.7.0.zip; \
echo "48b47519d16f33db4a13fcdeaa4e74b0b5f9a81eb9f193ca83c48657ed4b9f45 2.7.0.zip" | sha256sum -c -; \
unzip 2.7.0.zip -d extract; \
rm -rf /server/bf2/python; \
mv extract/bf2stats-2.7.0/src/python /server/bf2/python; \
rm -fv 2.7.0.zip;

# Install ESAI in all mods
WORKDIR /root
COPY ESAI-Standard-v4.2.zip ESAI-Standard-v4.2.zip
COPY lowercase-helper /usr/local/bin/lowercase-helper
RUN set -eux; \
sha256sum ESAI-Standard-v4.2.zip | grep '^ef4e5d0f1446b9a2ddb0b350f1334273681c0f64d9c38c506320db769b24499c '; \
# Lowercase all files in ESAI folder
for i in $( ls /server/bf2/mods ); do \
unzip ESAI-Standard-v4.2.zip -d /server/bf2/mods/$i; \
lowercase-helper --dir "/server/bf2/mods/$i/ESAI"; \
done; \
# Lowercase ESAI mapfiles' content
for i in $( find /server/bf2/mods/*/esai/mapfiles -type f ); do \
CONTENT=$( cat "$i" ); \
echo "$CONTENT" | tr '[:upper:]' '[:lower:]' > "$i"; \
done;

# Install esai-helper and configs
COPY esai-helper /usr/local/bin/esai-helper
COPY esai-optimized-strategies-bf2.txt /esai-optimized-strategies-bf2.txt
COPY esai-optimized-strategies-bf2all64.txt /esai-optimized-strategies-bf2all64.txt
COPY esai-optimized-strategies-xpack.txt /esai-optimized-strategies-xpack.txt

COPY healthcheck /healthcheck

# EXPOSE 16567/udp
# EXPOSE 29900/udp
# HEALTHCHECK CMD /healthcheck
WORKDIR /server/bf2
CMD [ "./start.sh", "+modPath", "mods/bf2all64" ]
Binary file not shown.
Loading

0 comments on commit 7b3c000

Please sign in to comment.