diff --git a/.drone.yml b/.drone.yml index f5da89b..c6c2ec2 100644 --- a/.drone.yml +++ b/.drone.yml @@ -2,11 +2,15 @@ kind: pipeline name: default steps: -- name: Remove extra stuff to make Docker images lighter - image: alpine:latest +- name: Make semi-static build with pyinstaller (NOT actually static) + image: python:latest commands: - - apk add git - - cd /drone/src && git apply docker.patch + - apt-get update + - apt-get install binutils -y + - pip install pyinstaller + - cd /drone/src && pip install -r requirements.txt && pyinstaller main.py + - chmod 777 /repo/dist/main/main + - cd /drone/src/dist/main && tar cvfz /drone/src/AlwaysDungeons.tar.gz * - name: build and publish image: plugins/docker pull: always diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..988afa6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +dist/ +build/ +.env +*.spec +AlwaysDungeons.tar.gz \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 0624e81..889a14a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,4 @@ -FROM python:latest +FROM python:slim-bookworm WORKDIR /data -COPY ./requirements.txt /data/ -RUN pip3 install -r /data/requirements.txt -COPY ./*.py /data/ -CMD python3 main.py \ No newline at end of file +ADD AlwaysDungeons.tar.gz /data +CMD ["/data/main"] \ No newline at end of file diff --git a/build-and-push.sh b/build-and-push.sh index 2e3b850..2a4ee36 100755 --- a/build-and-push.sh +++ b/build-and-push.sh @@ -2,11 +2,13 @@ set -e ORG="askiiart" NAME="discord-always-dungeons" -ID=$(docker build . -q) # Apply patch for Docker -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 *" + +# Build image +#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 +#docker tag ${ID} ${ORG}/${NAME}:latest +#docker push ${ORG}/${NAME}:latest