init commit

This commit is contained in:
Nick 2021-05-06 19:00:56 -04:00
parent 41e5caef58
commit 275c20f8a0
3 changed files with 46 additions and 0 deletions

22
.metroline.yml Normal file
View File

@ -0,0 +1,22 @@
version: '1'
image: docker
docker:
auth: '{{DOCKER_AUTH_JSON}}'
jobs:
remove_docker_before:
allowFailure: true
script:
- docker image rm docker.leffler.media/leffler.media/drone-cf-purge
build_docker:
script:
- docker build -t docker.leffler.media/leffler.media/drone-cf-purge .
- echo '{{DOCKER_PASS}}' | docker login -u '{{DOCKER_USER}}' --password-stdin https://docker.leffler.media
- docker push "docker.leffler.media/leffler.media/drone-cf-purge"
dependencies:
- remove_docker_before
remove_docker_after:
allowFailure: true
script:
- docker image rm docker.leffler.media/leffler.media/drone-cf-purge
dependencies:
- build_docker

5
Dockerfile Normal file
View File

@ -0,0 +1,5 @@
FROM alpine
ADD run.sh /bin/
RUN chmod +x /bin/run.sh
RUN apk -Uuv add curl ca-certificates bash
#ENTRYPOINT /bin/run.sh

19
run.sh Normal file
View File

@ -0,0 +1,19 @@
#!/bin/bash
set +x
if [[ -z "${URL}" ]]
then
echo "Please defind a URL"
exit 1
fi
if [[ -z "${BUNNYCDN_API}" ]]
then
echo "Please define API_TOKEN"
exit 1
fi
curl -s -X POST \
-H 'AccessKey: '"${BUNNYCDN_API}"'' \
-H 'Content-Length: 0' \
'https://api.bunny.net/purge?url='"${URL}"