Skip to content

Instantly share code, notes, and snippets.

@rhass
Forked from ruffsl/Dockerfile
Created April 10, 2016 18:24
Show Gist options
  • Save rhass/027bea23569353313307e0028cbca1be to your computer and use it in GitHub Desktop.
Save rhass/027bea23569353313307e0028cbca1be to your computer and use it in GitHub Desktop.
Chef ROS example
ros 'indigo' do
config 'ros-core'
action :install
end
catkin '/opt/catkin_ws' do
release 'indigo'
action :create
end
FROM ubuntu:14.04
RUN apt-get update && \
apt-get install -y \
git \
wget \
expect
# Install Chef DK
RUN wget https://packages.chef.io/stable/ubuntu/12.04/chefdk_0.12.0-1_amd64.deb && \
dpkg -i chefdk_0.12.0-1_amd64.deb
WORKDIR /root
ADD myapp.exp myapp.exp
RUN expect myapp.exp && \
echo "source \"https://supermarket.chef.io\"\n metadata\n cookbook \"ros\"" > myapp/Berksfile && \
cd myapp && \
berks install
RUN cd myapp && \
berks package && \
cp cookbooks-*.tar.gz .. && \
tar -xf cookbooks-*.tar.gz
WORKDIR /root/cookbooks
ADD default.rb myapp/recipes/default.rb
RUN echo "cookbook_path = \"/root/cookbooks\"" > myapp/recipes/client.rb && \
chef-client --local-mode -c myapp/recipes/client.rb myapp/recipes/default.rb
spawn berks cookbook myapp
expect "Overwrite \/root\/myapp\/chefignore? \(enter \"h\" for help\) "
send "Y"
$ docker build --tag chef:foo .
...
Step 10 : RUN echo "cookbook_path = \"/root/cookbooks\"" > myapp/recipes/client.rb && chef-client --local-mode -c myapp/recipes/client.rb myapp/recipes/default.rb
---> Running in c7ba9a4511de
[2016-04-07T22:22:58+00:00] INFO: Auto-discovered chef repository at /root
[2016-04-07T22:22:59+00:00] INFO: Started chef-zero at chefzero://localhost:8889 with repository at /root
One version per cookbook
[2016-04-07T22:22:59+00:00] INFO: Forking chef instance to converge...
[2016-04-07T22:22:59+00:00] INFO: *** Chef 12.8.1 ***
[2016-04-07T22:22:59+00:00] INFO: Chef-client pid: 18
[2016-04-07T22:22:59+00:00] INFO: HTTP Request Returned 404 Not Found: Object not found: chefzero://localhost:8889/nodes/f0726407848b
[2016-04-07T22:22:59+00:00] INFO: Run List is []
[2016-04-07T22:22:59+00:00] INFO: Run List expands to []
[2016-04-07T22:22:59+00:00] INFO: Starting Chef Run for f0726407848b
[2016-04-07T22:22:59+00:00] INFO: Running start handlers
[2016-04-07T22:22:59+00:00] INFO: Start handlers complete.
[2016-04-07T22:22:59+00:00] INFO: HTTP Request Returned 404 Not Found: Object not found:
[2016-04-07T22:22:59+00:00] INFO: Loading cookbooks []
[2016-04-07T22:22:59+00:00] ERROR: Running exception handlers
[2016-04-07T22:22:59+00:00] ERROR: Exception handlers complete
[2016-04-07T22:22:59+00:00] FATAL: Stacktrace dumped to /root/cookbooks/myapp/recipes/local-mode-cache/cache/chef-stacktrace.out
[2016-04-07T22:22:59+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-04-07T22:22:59+00:00] ERROR: No resource or method named `ros' for `Chef::Recipe "/root/cookbooks/myapp/recipes/default.rb"'
[2016-04-07T22:23:01+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
The command '/bin/sh -c echo "cookbook_path = \"/root/cookbooks\"" > myapp/recipes/client.rb && chef-client --local-mode -c myapp/recipes/client.rb myapp/recipes/default.rb' returned a non-zero code: 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment