From e9a368eca88e39205f04d233aa2b241bc0dea340 Mon Sep 17 00:00:00 2001 From: Sofian Brabez Date: Mon, 26 Nov 2018 10:45:16 +0000 Subject: [PATCH] Import docker-gc-build branch From [docker-gc-build](/Nitro/docker-gc/tree/sbrabez/docker-gc-build) branch which was existing in the Nitro's docker-gc fork. This will help us to have a better tracking and simplify the release process of new docker-gc version in our apt repository. --- Dockerfile | 27 +++++++++++++++++++++++++++ release.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 Dockerfile create mode 100755 release.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4f47ea1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +FROM ubuntu:xenial + +LABEL description="Docker image for building docker-gc debian package" \ + maintainer="infra-guild@gonitro.com" \ + repository="https://github.com/Nitro/docker-gc" + +ARG VERSION +ARG AWS_ACCESS_KEY_ID +ARG AWS_SECRET_ACCESS_KEY + +ADD . /tmp + +WORKDIR /tmp +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update && apt install -y \ + git \ + devscripts \ + debhelper \ + curl \ + build-essential \ + dh-make + +RUN DEBEMAIL="Infrastructure Guild " dch "Nitro build." \ + --newversion "${VERSION}" \ + --no-auto-nmu + +RUN debuild --no-lintian -us -uc -b \ No newline at end of file diff --git a/release.sh b/release.sh new file mode 100755 index 0000000..36f01f3 --- /dev/null +++ b/release.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +set -e + +DRY_RUN=' ' + +[ ! -f `which gpg` ] && { + echo 2>&1 "You need to install gnupg: brew install gnupg" + exit 2 +} + +[ ! -f `which deb-s3` ] && { + echo 2>&1 "You need to install deb-s3: gem install deb-s3" + exit 2 +} + +COMMIT=`git rev-parse --short HEAD` +VERSION="2:`cat version.txt`~${COMMIT}" +TAG="gonitro/docker-gc-build:${COMMIT}" +AWS_REGION=us-west-2 +BUCKET=nitro-apt-repo +NITRO_GPG_KEY=C5075270 + +$DRY_RUN docker build \ + -t ${TAG} \ + --build-arg VERSION=${VERSION} \ + --build-arg AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \ + --build-arg AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \ + -f ./Dockerfile . + +$DRY_RUN docker run -v /tmp/:/tmp ${TAG} /bin/bash -c 'cp /docker-gc*.deb /tmp' + +package=`ls /tmp/*.deb` +echo Debian Package generated into ${package} + +$DRY_RUN deb-s3 upload \ + --access-key-id=${AWS_ACCESS_KEY_ID} \ + --secret-access-key=${AWS_SECRET_ACCESS_KEY} \ + --s3-region=${AWS_REGION} \ + --bucket=${BUCKET} \ + --sign=${NITRO_GPG_KEY} ${package} || exit 1 +echo Successfully uploaded package into ${BUCKET} + +exit 0 -- 2.37.1