alwaysdungeons/build.sh

22 lines
800 B
Bash
Raw Permalink Normal View History

2023-08-28 21:00:35 -05:00
#!/usr/bin/env bash
set -e
2023-09-06 15:17:36 -05:00
# ORG and NAME aren't used unless push is enabled.
2023-08-28 21:00:35 -05:00
ORG="askiiart"
NAME="discord-always-dungeons"
2023-09-06 15:17:36 -05:00
PUSH="false"
2023-08-28 21:00:35 -05:00
2023-10-31 18:15:57 -05:00
# Apply patch for Docker
2023-09-06 15:01:08 -05:00
git apply docker.patch
# Build image
docker run -v .:/repo python:3.11-bookworm /bin/sh -c "apt update && apt install -y rustc && 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 *"
2023-09-06 15:01:08 -05:00
ID=$(docker build . -q)
2023-08-28 21:00:35 -05:00
# Could just do -t on the build, but this makes it easier to expand if needed.
2023-10-31 18:15:57 -05:00
if [ $ID == "true" && $PUSH="true" ]; then
2023-09-06 15:17:36 -05:00
docker tag ${ID} ${ORG}/${NAME}:latest
docker push ${ORG}/${NAME}:latest
else
echo Docker image ID: $ID
fi