From d77d926a5e429c5ad9a09900838eb4eb09f5110b Mon Sep 17 00:00:00 2001 From: Doridian Date: Fri, 29 Mar 2024 14:04:51 -0700 Subject: [PATCH] Create copydone file to make sure the copy is done --- .dockerignore | 3 +++ .gitignore | 1 + Dockerfile | 2 +- dockerboot.sh | 20 -------------------- misc/dockerboot.sh | 21 +++++++++++++++++++++ 5 files changed, 26 insertions(+), 21 deletions(-) create mode 100644 .dockerignore delete mode 100755 dockerboot.sh create mode 100755 misc/dockerboot.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..4d2dd94 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +__pycache__ +*.pyc +.copydone diff --git a/.gitignore b/.gitignore index f6c3065..e99a0e7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ __pycache__ *.pyc +.copydone diff --git a/Dockerfile b/Dockerfile index 1bd7940..73dc4f2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,4 +21,4 @@ ENV SPACEAGE_SERVER_TOKEN=dummy COPY . /opt/StarLord -ENTRYPOINT ["/opt/StarLord/dockerboot.sh"] +ENTRYPOINT ["/opt/StarLord/misc/dockerboot.sh"] diff --git a/dockerboot.sh b/dockerboot.sh deleted file mode 100755 index 7513f0c..0000000 --- a/dockerboot.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -set -ex - -SERVER_DIR="${HOME}" -STARLORD_DIR="${SERVER_DIR}/StarLord" -STARLORD_MAIN="${STARLORD_DIR}/__main__.py" - -if [ -f "${STARLORD_MAIN}" ]; then - exec /usr/bin/python3 "${STARLORD_MAIN}" - exit 1 -fi - -if [ -d "${STARLORD_DIR}" ]; then - rm -rf "${STARLORD_DIR}" -fi - -cp -r /opt/StarLord "${STARLORD_DIR}" - -exec /usr/bin/python3 "${STARLORD_MAIN}" -exit 1 diff --git a/misc/dockerboot.sh b/misc/dockerboot.sh new file mode 100755 index 0000000..c3c873d --- /dev/null +++ b/misc/dockerboot.sh @@ -0,0 +1,21 @@ +#!/bin/sh +set -ex + +SERVER_DIR="${HOME}" +STARLORD_DIR="${SERVER_DIR}/StarLord" +STARLORD_COPY_DONE_FILE="${STARLORD_DIR}/.copydone" + +if [ -f "${STARLORD_COPY_DONE_FILE}" ]; then + exec /usr/bin/python3 "${STARLORD_DIR}" + exit 1 +fi + +if [ -d "${STARLORD_DIR}" ]; then + rm -rf "${STARLORD_DIR}" +fi + +cp -r /opt/StarLord "${STARLORD_DIR}" +touch "${STARLORD_COPY_DONE_FILE}" + +exec /usr/bin/python3 "${STARLORD_DIR}" +exit 1