Skip to content

Instantly share code, notes, and snippets.

@tkuchiki
Last active August 29, 2015 14:11
Show Gist options
  • Save tkuchiki/33b2068199f56c883f30 to your computer and use it in GitHub Desktop.
Save tkuchiki/33b2068199f56c883f30 to your computer and use it in GitHub Desktop.
Docker provisioning for chef
chef_root File.dirname(__FILE__)
log_level :info
log_location STDOUT
cookbook_path File.expand_path('cookbooks', chef_root)
file_cache_path '/var/chef/cache'
local_mode true
file_backup_path '/var/chef/backup'
remote_file "#{Chef::Config[:file_cache_path]}/nginx.rpm" do
source "http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm"
end
package "install nginx-release" do
source "#{Chef::Config[:file_cache_path]}/nginx.rpm"
end
package "nginx"
file "#{Chef::Config[:file_cache_path]}/nginx.rpm" do
action :delete
end
FROM centos:centos6
EXPOSE 80
ADD cookbooks /root/chef/cookbooks/
ADD nodes /root/chef/nodes/
ADD roles /root/chef/roles/
ADD client.rb /root/chef/client.rb
RUN curl -L https://www.opscode.com/chef/install.sh | bash
RUN cd /root/chef && chef-client -c client.rb -j nodes/node.json
CMD ["/usr/sbin/nginx", "-g", "daemon off;"]
{"run_list":"recipe[nginx]"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment