mirror of
https://github.com/luzifer-docker/awscli.git
synced 2024-12-20 04:51:19 +00:00
Basic files for building awscli image
This commit is contained in:
commit
b3ba6e3807
5 changed files with 100 additions and 0 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
jq
|
||||
.env
|
7
.travis.yml
Normal file
7
.travis.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
sudo: required
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
script:
|
||||
- bash build.sh
|
11
Dockerfile
Normal file
11
Dockerfile
Normal file
|
@ -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"]
|
21
README.md
Normal file
21
README.md
Normal file
|
@ -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
|
||||
```
|
59
build.sh
Executable file
59
build.sh
Executable file
|
@ -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
|
Loading…
Reference in a new issue