From f7f014e711dbde03e67b3735755f7c23bed205b7 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Tue, 27 Sep 2022 19:19:52 -0400 Subject: [PATCH] *Initial version --- Dockerfile | 5 +++++ aptly.sh | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 Dockerfile create mode 100644 aptly.sh 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}"