diff --git a/.metroline.yml b/.metroline.yml new file mode 100644 index 0000000..0f7ba3e --- /dev/null +++ b/.metroline.yml @@ -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 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..519de4b --- /dev/null +++ b/Dockerfile @@ -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 diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..b1afcc4 --- /dev/null +++ b/run.sh @@ -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}"