initial commit

This commit is contained in:
Rowan 2024-12-28 00:16:14 -06:00
commit ad38c09210
3 changed files with 25 additions and 0 deletions

6
Containerfile Normal file
View file

@ -0,0 +1,6 @@
FROM docker.io/library/python:3.13.1-alpine3.21
RUN apk --update add jq; pip install b2
WORKDIR app
ADD b2-retention.sh entrypoint.sh ./
ENTRYPOINT ["./entrypoint.sh"]

14
b2-retention.sh Executable file
View file

@ -0,0 +1,14 @@
#!/usr/bin/env sh
TO_DELETE=$( b2v4 ls b2://"$BUCKET_NAME" | tac | tail -n +8 | tr '\n' ' ' )
PIDS=""
for file in $TO_DELETE; do
b2v4 rm "b2://${BUCKET_NAME}/${file}" &
PIDS="$PIDS $!"
done
for pid in $PIDS; do
wait "${pid}"
done

5
entrypoint.sh Executable file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env sh
set +e
./b2-retention.sh