|
| 1 | +ARG ARSVERSION="latest" |
| 2 | +ARG GITHUBOWNER="bestnaf" |
| 3 | +ARG GITHUBREPO="ARS" |
| 4 | +ARG GBINSTALLLOC="/opt/gunbot" |
| 5 | +ARG GBMOUNT="/mnt/gunbot" |
| 6 | +ARG ARS="ARS_lin.zip" |
| 7 | +ARG GUNBOTVERSION="latest" |
| 8 | +ARG GBPORT=5000 |
| 9 | +ARG MAINTAINER="computeronix" |
| 10 | +ARG WEBSITE="https://hub.docker.com/r/computeronix/ars" |
| 11 | +ARG DESCRIPTION="(Unofficial) ARS Docker Container - ${GUNBOTVERSION} - ${ARSVERSION} |
| 12 | +
|
| 13 | +#SCRATCH WORKSPACE FOR BUILDING IMAGE |
| 14 | +FROM --platform="linux/amd64" debian:bullseye AS ars-builder |
| 15 | +ARG ARSVERSION |
| 16 | +ARG GITHUBOWNER |
| 17 | +ARG GITHUBREPO |
| 18 | +ARG GBINSTALLLOC |
| 19 | +ARG GBMOUNT |
| 20 | +
|
| 21 | +WORKDIR /tmp |
| 22 | +
|
| 23 | +#BUILDING IMAGE |
| 24 | +#update mirrors and install packages |
| 25 | +RUN apt-get update && apt-get install -y wget jq unzip \ |
| 26 | + #remove mirrors |
| 27 | + && rm -rf /var/lib/apt/lists/* \ |
| 28 | + #pull ${ARSVERSION} from official GitHub and extract linux client |
| 29 | + && wget -q -nv -O ars.zip $(wget -q -nv -O- https://api.github.com/repos/${GITHUBOWNER}/${GITHUBREPO}/releases/${ARSVERSION} 2>/dev/null | jq -r '.assets[] | select(.browser_download_url | contains("lin.zip")) | .browser_download_url') \ |
| 30 | + && unzip -d . ars.zip \ |
| 31 | + && mkdir -p gunbot/ARS \ |
| 32 | + && mv Lin/* gunbot/ARS \ |
| 33 | + #injecting into custom.sh |
| 34 | + #check for ARS directory BUT don't link it for persistence |
| 35 | + && printf "if [ ! -d ${GBMOUNT}/ARS ]; then \n" >> gunbot/custom.sh \ |
| 36 | + && printf " mkdir ${GBMOUNT}/ARS\n" >> gunbot/custom.sh \ |
| 37 | + && printf "fi\n" >> gunbot/custom.sh \ |
| 38 | + #check for USR_VARS.ini file |
| 39 | + && printf "if [ ! -f ${GBMOUNT}/ARS/USR_VARS.ini ]; then \n" >> gunbot/custom.sh \ |
| 40 | + && printf "cp ${GBINSTALLLOC}/ARS/USR_VARS_example.ini ${GBMOUNT}/ARS/USR_VARS.ini\n" >> gunbot/custom.sh \ |
| 41 | + && printf "fi\n" >> gunbot/custom.sh \ |
| 42 | + && printf "ln -sf ${GBMOUNT}/ARS/USR_VARS.ini ${GBINSTALLLOC}/ARS/USR_VARS.ini\n" >> gunbot/custom.sh \ |
| 43 | + #check for config.py file |
| 44 | + && printf "if [ ! -f ${GBMOUNT}/ARS/config.py ]; then \n" >> gunbot/custom.sh \ |
| 45 | + && printf "cp /tmp/config.py ${GBMOUNT}/ARS/config.py\n" >> gunbot/custom.sh \ |
| 46 | + && printf "fi\n" >> gunbot/custom.sh \ |
| 47 | + && printf "ln -sf ${GBMOUNT}/ARS/config.py ${GBINSTALLLOC}/ARS/config.py\n" >> gunbot/custom.sh \ |
| 48 | + #inject config -> MM_PATH -> /opt/gunbot |
| 49 | + && printf "input=\"/opt/gunbot/ARS/USR_VARS.ini\"\n" >> gunbot/custom.sh \ |
| 50 | + && printf "while IFS= read -r line\n" >> gunbot/custom.sh \ |
| 51 | + && printf "do\n" >> gunbot/custom.sh \ |
| 52 | + && printf "if [[ \"\${line}\" == *\"MM_PATH\"* ]]; then\n" >> gunbot/custom.sh \ |
| 53 | + && printf " line=\"MM_PATH = /opt/gunbot\"\n" >> gunbot/custom.sh \ |
| 54 | + && printf "fi\n" >> gunbot/custom.sh \ |
| 55 | + && printf "echo \"\${line}\" >> /tmp/USR_VARS_tmp.ini\n" >> gunbot/custom.sh \ |
| 56 | + && printf "done < \"\${input}\"\n" >> gunbot/custom.sh \ |
| 57 | + && printf "mv /tmp/USR_VARS_tmp.ini ${GBINSTALLLOC}/ARS/USR_VARS.ini\n" >> gunbot/custom.sh \ |
| 58 | + #overwrite runner.sh bash script |
| 59 | + && printf "#!/bin/bash\n" > gunbot/runner.sh \ |
| 60 | + #run gunbot |
| 61 | + && printf "${GBINSTALLLOC}/gunthy-linux &\n" >> gunbot/runner.sh \ |
| 62 | + #run ars |
| 63 | + && printf "cd ${GBINSTALLLOC}/ARS\n" >> gunbot/runner.sh \ |
| 64 | + && printf "${GBINSTALLLOC}/ARS/mm_anti_rekt\n" >> gunbot/runner.sh |
| 65 | +
|
| 66 | +#BUILD THE RUN IMAGE |
| 67 | +FROM --platform="linux/amd64" computeronix/gunbot:latest |
| 68 | +ARG MAINTAINER |
| 69 | +ARG WEBSITE |
| 70 | +ARG DESCRIPTION |
| 71 | +ARG GBINSTALLLOC |
| 72 | +ARG GBPORT |
| 73 | +ENV GUNBOTLOCATION=${GBINSTALLLOC} |
| 74 | +
|
| 75 | +LABEL \ |
| 76 | + maintainer="${MAINTAINER}" \ |
| 77 | + website="${WEBSITE}" \ |
| 78 | + description="${DESCRIPTION}" |
| 79 | +
|
| 80 | +COPY --from=ars-builder /tmp/gunbot ${GBINSTALLLOC} |
| 81 | +COPY config.py /tmp/config.py |
| 82 | +
|
| 83 | +WORKDIR ${GBINSTALLLOC} |
| 84 | +
|
| 85 | +RUN apt-get update && apt-get install -y chrony jq unzip openssl python \ |
| 86 | + && rm -rf /var/lib/apt/lists/* \ |
| 87 | + && chmod +x "${GBINSTALLLOC}/custom.sh" \ |
| 88 | + && chmod +x "${GBINSTALLLOC}/runner.sh" \ |
| 89 | + && chmod +x "${GBINSTALLLOC}/ARS/mm_anti_rekt" |
| 90 | +
|
| 91 | +EXPOSE ${GBPORT} |
| 92 | +CMD ["bash","-c","${GUNBOTLOCATION}/startup.sh"] |
0 commit comments