Skip to content

Instantly share code, notes, and snippets.

@donaldguy
Last active February 26, 2016 23:33
Show Gist options
  • Save donaldguy/9c287c816dd355547499 to your computer and use it in GitHub Desktop.
Save donaldguy/9c287c816dd355547499 to your computer and use it in GitHub Desktop.
Rockerfile for chef Policyfile cookbook ( https://github.com/grammarly/rocker )
{{ if .FromScratch }}
FROM ubuntu:trusty
{{ else }}
FROM your/cookbook:latest
{{ end }}
# use chefdk from host
MOUNT /opt/chefdk:/opt/chefdk
# use ssh environment from host
MOUNT {{ .Env.HOME }}/.ssh/known_hosts:/root/.ssh/known_hosts
MOUNT {{ .Env.SSH_AUTH_SOCK }}:{{ .Env.SSH_AUTH_SOCK }}
ENV SSH_AUTH_SOCK {{ .Env.SSH_AUTH_SOCK }}
RUN apt-get install git -y
ADD . /chef
WORKDIR /chef
RUN /opt/chefdk/bin/chef install \
&& /opt/chefdk/bin/chef export bundle && cd bundle \
&& /opt/chefdk/bin/chef-client -z -F doc \
&& rm -rf /chef/bundle
TAG your/cookbook:latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment