-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mario Loria
committed
Jun 16, 2016
0 parents
commit cfb55f0
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
``` |