Git Product home page Git Product logo

ansible-role-ecr_container_build's Introduction

Ansible Role: ECR Container Build

Build Status

An Ansible Role that installs builds Docker container images and (optionally) pushes them to AWS ECR Repositories.

Requirements

  • Docker
  • Pip packages: boto3, docker

Role Variables

Available variables are listed below, along with default values (see defaults/main.yml):

ecr_image_src_dir: ../my-project
ecr_image_name: namespace/my-project

A source directory containing a Dockerfile and any required resources, and the image name (typically in the form namespace/project) for the docker image that is built.

ecr_image_buildargs: {}

Build args to pass to the docker_image module when building the Docker image. Args should be passed as an object with key-value pairs, e.g. { name: value, name2: value2 }

ecr_image_tags: ['latest']

The tags to apply to the final image which is pushed to ECR.

ecr_login_required: false

Set this to true if you are using ECR as the source for your container build (e.g. FROM in Dockerfile).

ecr_push: true

Whether to push the built image to ECR. Set to false if you're just testing the image build portion or you cannot connect to ECR.

ecr_region: us-east-1
ecr_account_id: '123456789012'
ecr_url: "{{ ecr_account_id }}.dkr.ecr.{{ ecr_region }}.amazonaws.com"

AWS account details for ECR.

Dependencies

None.

Example Playbook

Building locally (assuming you already have Docker CE and the docker pip package installed):

---
- hosts: localhost
  connection: local
  gather_facts: false

  vars:
    ecr_image_src_dir: ../my-project
    ecr_image_name: namespace/my-project
    ecr_image_tags: ['latest','1.2.3']
    ecr_account_id: '123456789012'
    pip_install_packages: ['docker']

  roles:
    - role: geerlingguy.ecr_container_build

Building on a remote server:

---
- hosts: localhost
  connection: local
  gather_facts: false

  vars:
    ecr_image_src_dir: ../my-project
    ecr_image_name: namespace/my-project
    ecr_image_tags: ['latest','1.2.3']
    ecr_account_id: '123456789012'
    pip_install_packages: ['docker']

  roles:
    - role: geerlingguy.docker
    - role: geerlingguy.pip
    - role: geerlingguy.ecr_container_build

License

MIT / BSD

Author Information

This role was created in 2018 by Jeff Geerling, author of Ansible for DevOps.

ansible-role-ecr_container_build's People

Contributors

geerlingguy avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.