Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Mario Loria committed Jun 16, 2016
0 parents commit cfb55f0
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM hashicorp/packer:0.10.0

# Define our acceptable ansible version
ENV ANSIBLE_VERSION 2.1.0.0

# Import a testing edge for more recent pkgs
RUN echo "http://dl-4.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories

# update/install a bunch of stuffs for pythons
RUN apk add --update py-pip build-base python-dev py-boto && rm -rf /var/cache/apk/**/

# Install ansible
RUN pip install ansible>=${ANSIBLE_VERSION}

# Set a default working dir (nice for bind mounting things inside)
RUN mkdir /build
WORKDIR /build

# Packer needs this set:
# https://github.com/mitchellh/packer/blob/49067e732a66c9f7a87843a2c91100de112b21cc/provisioner/ansible/provisioner.go#L127
ENV USER root

# Set our entrypoint back to the default (gitlab-runner needs this)
ENTRYPOINT ["/bin/sh", "-c"]
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## Docker-packer-ansible

This image aims to provide a usable packer image with ansible slipstreamed
inside for easy utilization of Ansible Local/Remote builders!

A few notes:

* I've based off the most official Packer image, `hashicorp/packer`
* This utilizes Alpine Linux which means its more nimble ;)
* The entrypoint has been reset to the Docker default `/bin/sh/ -c` so this
image is more standardized for things like `gitlab-runner` or other
application.
* I'll maintain tags which specify both packer+ansible versions, although I will
only update this as I need to for myself and my uses. Pull Requests are very
welcome and will be responded to as quickly as possible!


#### Example

Given you bind mount a directory `ami_build` which has your packer.json
and related ansible scripts, something like this should work.

```
docker run -v /home/user/ami_build:/build -ti -e AWS_ACCESS_KEY=blah
-e AWS_SECRET_KEY inanimate/packer-ansible "packer build packer.json"
```

0 comments on commit cfb55f0

Please sign in to comment.