commit b3ba6e38072baa8e73c8cace63d0498a8baeaaa0 Author: Knut Ahlers Date: Fri Jun 24 22:38:54 2016 +0200 Basic files for building awscli image diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b95bf65 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +jq +.env diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..d66ce60 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +sudo: required + +services: + - docker + +script: + - bash build.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6f4fe3e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM python:2.7-onbuild + +RUN set -ex \ + && apt-get update \ + && apt-get install -y groff \ + && apt-get autoremove -y + +VOLUME ["/root/.aws"] + +ENTRYPOINT ["/usr/local/bin/aws"] +CMD ["help"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..0c7a56d --- /dev/null +++ b/README.md @@ -0,0 +1,21 @@ +# Luzifer / awscli + +This repository contains a simple build for the [`awscli` util](https://aws.amazon.com/cli/) as a replacement for a local installation of the utility. + +## Usage + +```bash +$ docker run --rm -ti \ + -v "${HOME}/.aws:/root/.aws" \ + -e "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" \ + -e "AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" \ + -e "AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION}" \ + quay.io/luzifer/awscli help +``` + +Or you could create a shell alias for that command and use it like a local installation of awscli: + +```bash +$ alias aws='docker run --rm -ti -v "${HOME}/.aws:/root/.aws" -e "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" -e "AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" -e "AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION}" quay.io/luzifer/awscli' +$ aws help +``` diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..e5204fb --- /dev/null +++ b/build.sh @@ -0,0 +1,59 @@ +#!/bin/bash -e + +HOST_OS=$(uname -s) + +### ---- ### + +echo "Switch back to master" +git checkout master +git reset --hard origin/master + +### ---- ### + +if ! [ -e jq ]; then + echo "Loading local copy of jq-1.5" + + case ${HOST_OS} in + Linux) + curl -sSLo ./jq https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 + ;; + Darwin) + curl -sSLo ./jq https://github.com/stedolan/jq/releases/download/jq-1.5/jq-osx-amd64 + ;; + *) + echo "/!\\ Unable to download jq for ${HOST_OS}" + exit 1 + ;; + esac + + chmod +x jq +fi + +### ---- ### + +echo "Fetching latest version number of awscli" + +AWSCLI_VERSION=$(curl -sSL https://pypi.python.org/pypi/awscli/json | ./jq -r .info.version) + +if ( git tag -l ${AWSCLI_VERSION} | grep -q ${AWSCLI_VERSION} ); then + echo "/!\\ Already got a tag for version ${AWSCLI_VERSION}, stopping now" + exit 0 +fi + +echo "Writing requirements.txt" +echo "awscli==${AWSCLI_VERSION}" > requirements.txt + +### ---- ### + +echo "Testing build..." +docker build . + +### ---- ### + +echo "Updating repository..." +git add requirements.txt +git -c user.name='travis' -c user.email='travis' \ + commit -m "awscli ${AWSCLI_VERSION}" +git tag ${AWSCLI_VERSION} + +git push -q https://${GH_USER}:${GH_TOKEN}@github.com/luzifer-docker/awscli master --tags