From b40e26554c29b0e4e577f2694c33dfe913d44a9d Mon Sep 17 00:00:00 2001 From: askiiart Date: Wed, 6 Sep 2023 15:17:36 -0500 Subject: [PATCH] Fix readme and script --- README.md | 5 +++-- build-and-push.sh => build.sh | 10 ++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) rename build-and-push.sh => build.sh (71%) diff --git a/README.md b/README.md index 764d78e..a295bde 100644 --- a/README.md +++ b/README.md @@ -72,9 +72,12 @@ Run this to build the image: ```bash git apply docker.patch +docker run -v .:/repo python /bin/sh -c "cd /repo && pip install -r requirements.txt && apt-get update && apt-get install binutils -y && pip install pyinstaller && pyinstaller main.py && cd /repo/dist/main && chmod -R 777 /repo/dist/main && tar cvfz /repo/AlwaysDungeons.tar.gz *" docker build . ``` +Alternatively, you can just run `./build-and-push.sh`, which will do all that for you. Just make sure to set the variables before running it. + ## Run the dev image This image is built for development. It mounts the current directory to /data, installs all the dependencies, and runs the bot from there. Keep in mind this runs differently than the production image. It uses load_dotenv, not `--env-file`. @@ -91,5 +94,3 @@ services: volumes: - .:/data ``` - -Alternatively, you can just run `./build-and-push.sh`, which will apply the patch, build the image, and push it to the registry. Just make sure to fix the variables before running it. diff --git a/build-and-push.sh b/build.sh similarity index 71% rename from build-and-push.sh rename to build.sh index c6c1765..14f19e9 100755 --- a/build-and-push.sh +++ b/build.sh @@ -1,7 +1,9 @@ #!/usr/bin/env bash set -e +# ORG and NAME aren't used unless push is enabled. ORG="askiiart" NAME="discord-always-dungeons" +PUSH="false" # Apply patch for Docker git apply docker.patch @@ -11,5 +13,9 @@ docker run -v .:/repo python /bin/sh -c "cd /repo && pip install -r requirements ID=$(docker build . -q) # Could just do -t on the build, but this makes it easier to expand if needed. -docker tag ${ID} ${ORG}/${NAME}:latest -docker push ${ORG}/${NAME}:latest +if [ $ID == "true" ]; then + docker tag ${ID} ${ORG}/${NAME}:latest + docker push ${ORG}/${NAME}:latest +else + echo Docker image ID: $ID +fi \ No newline at end of file