Sign inSign up

somedeveloper/dind-aws-cli

By somedeveloper

•Updated over 7 years ago

Image
0

50K+

somedeveloper/dind-aws-cli repository overview

DOCKER IN DOCKER AND AWS SAM CLI is a docker image created to make the AWS/SAM CLI tools available during pipeline processes. Due to the nature of usage, it is the simplest process to not require a docker login prior to each usage of this image, and for this reason it is hosted on Docker Hub.

Reasons for using:

  • Keeps it simple and small.
  • Uses official docker:18.06.3-ce-dind as base image.
  • Includes docker and docker-compose cli.
  • Uses AWS recommended strategy for installation -- python + pip. see here⁠.
  • Includes aws-sam-cli for those Serverless nerds 8-).
  • Its public and doesn't require a login.
  • Great for CI/CD pipelines -- haven't used it for anything else so haven't weighed the pros and cons.
FROM docker:18.06.3-ce-dind

RUN echo "Install AWS" && \
    apk add --no-cache bash build-base ca-certificates curl gettext git libffi-dev linux-headers make musl-dev openldap-dev openssh-client python3 py-pip python3-dev rsync tzdata && \
    pip3 install --upgrade pip && \
    pip3 install awscli boto3 'PyYAML<=3.13,>=3.10' aws-sam-cli docker-compose --upgrade && \
    echo "Done install AWS" && \
    echo "Cleaning files!" && \
    rm -rf /tmp/* /var/cache/apk/* && \
    docker --version && \
    docker-compose --version && \
    aws --version && \
    sam --version && \
    echo "Done!"

⁠Usage

⁠Gitlab pipeline
push-to-ecr:
  image: somedeveloper/dind-aws-cli
  stage: deploy
    environment:
    AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
    AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
    AWS_DEFAULT_REGION: us-west-2
    AWS_ECR_URL: <insert-ecr-url-here>
  script:
    # Build the docker image from the current version. Also tags the image.
    - docker build -t $AWS_ECR_URL/group/service:latest .
    # Login to AWS ECR.
    - $(aws ecr get-login --no-include-email --region $AWS_DEFAULT_REGION)
    # Push the image to ECR.
    # Until the following issue is resolved, we must push each tag separately: https://github.com/docker/cli/issues/267
    - docker push $AWS_ECR_URL/group/service:latest
validate:
  image: somedeveloper/dind-aws-cli
  stage: test
  environment:
    AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
    AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
    AWS_DEFAULT_REGION: us-west-2
  script:
    - sam validate
⁠CLI/BASH
docker run --rm -it somedeveloper/dind-aws-cli:latest -e AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} -e AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} -e AWS_DEFAULT_REGION=us-west-2 "/bin/bash"

Hint: You can skip the -e flags if you have those environment variables set in your session.

Tag summary

Content type

Image

Digest

Size

205.7 MB

Last updated

over 7 years ago

docker pull somedeveloper/dind-aws-cli