diff --git a/github-copy/Dockerfile b/github-copy/Dockerfile new file mode 100644 index 0000000..3e99d99 --- /dev/null +++ b/github-copy/Dockerfile @@ -0,0 +1,10 @@ +FROM radial/busyboxplus:curl + +MAINTAINER Ric Lister, rlister@gmail.com + +WORKDIR /app + +ADD ghcp.sh /app/ +RUN chmod 0755 ghcp.sh + +ENTRYPOINT [ "/app/ghcp.sh" ] diff --git a/github-copy/ghcp.sh b/github-copy/ghcp.sh new file mode 100644 index 0000000..b940098 --- /dev/null +++ b/github-copy/ghcp.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +## loop each pair of args as a src path and dest dir +while [ $# -gt 0 ] +do + src=$1; shift + dest=$1; shift + mkdir -p "$dest" + ( + cd "$dest" && \ + /usr/bin/curl -sOL \ + -H "Authorization: token $TOKEN" \ + -H 'Accept: application/vnd.github.v3.raw' \ + "https://api.github.com/repos/${REPO}/contents/${src}" + ) +done