diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..243e637 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM alpine +ADD aptly.sh /bin/ +RUN chmod +x /bin/aptly.sh +RUN apk -Uuv add curl ca-certificates bash jo +ENTRYPOINT /bin/aptly.sh diff --git a/aptly.sh b/aptly.sh new file mode 100644 index 0000000..349426a --- /dev/null +++ b/aptly.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +APT_SERVICE_API="https://apt.lumeweb.com" + +USERNAME="${PLUGIN_APT_USERNAME}" +PASSWORD="${PLUGIN_APT_PASSWORD}" + +SNAPSHOT_NAME=$(date -u -%s) + +PACKAGE_NAME="$(basename ${PLUGIN_PACKAGE} .deb)" + +curl -u "${USERNAME}:${PASSWORD}" -X POST -F file=@${PLUGIN_PACKAGE} "http://${APT_SERVICE_API}/api/files/${PACKAGE_NAME}" +curl -u "${USERNAME}:${PASSWORD}" -X POST -F file=@${PLUGIN_PACKAGE} "http://${APT_SERVICE_API}/api/repos/${PLUGIN_REPO}/file/${PACKAGE_NAME}" + +JSON=$(jo Name="${SNAPSHOT_NAME}" Passphrase="${PLUGIN_GPG_PASSWORD}") +curl -u "${USERNAME}:${PASSWORD}" ${APT_SERVICE_API}/api/repos/${PLUGIN_REPO}/snapshots -d "${JSON}" + +JSON=$(jo Storage="s3" Prefix="." Distribution="ubuntu" Architectures="amd64" Passphrase="${PLUGIN_GPG_PASSWORD}") +curl -u "${USERNAME}:${PASSWORD}" ${APT_SERVICE_API}/api/publish -d "${JSON}"