-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
57 lines (49 loc) · 2.88 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ARG docker_image=amazonlinux:2018.03.0.20190826-with-sources
ARG docker_image=amazonlinux:2.0.20190823.1-with-sources
FROM ${docker_image}
# Amazon Linux AMI 2018.03 (v1 - el6)
# https://hub.docker.com/_/amazonlinux
MAINTAINER Levon Becker "[email protected]"
LABEL version="3.0.0" \
description="Amazon Linux Image built from bonusbits_base cookbook." \
github="https://github.com/bonusbits/bonusbits_base" \
website="https://www.bonusbits.com"
# Build Cookbook Args
#ARG chef_client_version=15.2.20
ARG chefdk_version=4.5.0
ARG cookbook_name=bonusbits_base
ARG chef_role=base
ARG chef_environment=bonusbits_base
ARG chef_config_path=/etc/chef
# Install Basics
RUN yum clean all \
&& yum update -y --exclude=kernel* \
&& yum install -y curl git htop iotop net-tools openssh-clients openssh-server \
procps sudo upstart util-linux vim-enhanced vim-minimal which
# Install Chef Client
#RUN curl -L https://omnitruck.chef.io/install.sh | bash -s -- -v ${chef_client_version}
# Install ChefDK
## Less work then chef-client install because everything for testing and berkshelf is included.
## https://packages.chef.io/files/stable/chefdk/4.5.0/el/7/chefdk-4.5.0-1.el7.x86_64.rpm
RUN curl -L https://omnitruck.chef.io/install.sh | bash -s -- -P chefdk -v ${chefdk_version}
# Setup Chef Client
RUN mkdir -p ${chef_config_path}
WORKDIR ${chef_config_path}
RUN mkdir -p cookbooks/${cookbook_name} checksums environments cache backup data_bags roles
COPY . cookbooks/${cookbook_name}/
COPY test/roles/* roles/
COPY test/environments/* environments/
COPY test/data_bags/* data_bags/
COPY test/node/client.rb ${chef_config_path}/client.rb
# Download Dependant Cookbooks
WORKDIR ${chef_config_path}/cookbooks/${cookbook_name}
RUN /opt/chefdk/bin/berks install && /opt/chefdk/bin/berks vendor ${chef_config_path}/cookbooks/
# Run Chef
# /opt/chefdk/bin/chef-client -z --chef-license accept --config /etc/chef/client.rb -o "role[base]" --environment "bonusbits_base" --log_level info --force-formatter --chef-zero-port 8889
RUN /opt/chefdk/bin/chef-client -z --chef-license accept --config ${chef_config_path}/client.rb -o "role[${chef_role}]" --environment "${chef_environment}" --log_level info --force-formatter --chef-zero-port 8889
# Run Chef when Container Created
#WORKDIR ${chef_config_path}
#ENTRYPOINT [/opt/chefdk/bin/chef-client -z --chef-license accept --config ${chef_config_path}/client.rb -o "role[${chef_role}]" --environment "${chef_environment}" --log_level info --force-formatter --chef-zero-port 8889]
#CMD ["/bin/sh", "-c", "/opt/chefdk/bin/chef-client", "-z", "--config /etc/chef/client.rb", "-o 'role[base]'", "--environment 'bonusbits_base'", "--log_level info", "--force-formatter", "--chef-zero-port 8889"]
#CMD /opt/chefdk/bin/chef-client -z --config /etc/chef/client.rb -o "role[base]" --environment "bonusbits_base" --log_level info --force-formatter --chef-zero-port 8889
#EXPOSE 22