Skip to content

Commit

Permalink
Automated Docker image builds
Browse files Browse the repository at this point in the history
Signed-Off-By: Parth Yadav<[email protected]>
  • Loading branch information
parthyadav3105 committed Feb 22, 2020
1 parent 0faa2c8 commit 010c159
Show file tree
Hide file tree
Showing 155 changed files with 108 additions and 93 deletions.
3 changes: 0 additions & 3 deletions 2013/setting.json

This file was deleted.

3 changes: 0 additions & 3 deletions 404/setting.json

This file was deleted.

3 changes: 0 additions & 3 deletions 8.8.8.8/setting.json

This file was deleted.

3 changes: 0 additions & 3 deletions Bug/setting.json

This file was deleted.

3 changes: 0 additions & 3 deletions Great!/setting.json

This file was deleted.

3 changes: 0 additions & 3 deletions apple/setting.json

This file was deleted.

3 changes: 0 additions & 3 deletions binary/setting.json

This file was deleted.

3 changes: 0 additions & 3 deletions bird/setting.json

This file was deleted.

3 changes: 0 additions & 3 deletions c++/setting.json

This file was deleted.

3 changes: 0 additions & 3 deletions camera/setting.json

This file was deleted.

3 changes: 0 additions & 3 deletions complete/setting.json

This file was deleted.

3 changes: 0 additions & 3 deletions ctrl+s/setting.json

This file was deleted.

3 changes: 0 additions & 3 deletions ctrlplusz/setting.json

This file was deleted.

3 changes: 0 additions & 3 deletions death/setting.json

This file was deleted.

3 changes: 0 additions & 3 deletions fifa/setting.json

This file was deleted.

3 changes: 0 additions & 3 deletions firefox/setting.json

This file was deleted.

3 changes: 0 additions & 3 deletions floppy/setting.json

This file was deleted.

2 changes: 2 additions & 0 deletions hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build_machine]
127.0.0.1 ansible_connection=local
3 changes: 0 additions & 3 deletions html/setting.json

This file was deleted.

3 changes: 0 additions & 3 deletions javascript/setting.json

This file was deleted.

3 changes: 0 additions & 3 deletions kubernetes/setting.json

This file was deleted.

3 changes: 0 additions & 3 deletions manager/setting.json

This file was deleted.

3 changes: 0 additions & 3 deletions mega/setting.json

This file was deleted.

3 changes: 0 additions & 3 deletions no1/setting.json

This file was deleted.

3 changes: 0 additions & 3 deletions no2/setting.json

This file was deleted.

3 changes: 0 additions & 3 deletions no3/setting.json

This file was deleted.

8 changes: 8 additions & 0 deletions playbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

- hosts: build_machine
remote_user: root
vars:
- target_dir: riddles
roles:
- {role: build_images}
- {role: deploy_websites}
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions riddles/2013/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2013
File renamed without changes.
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions riddles/404/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
404
File renamed without changes.
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions riddles/8.8.8.8/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8.8.8.8
File renamed without changes.
File renamed without changes.
File renamed without changes
1 change: 1 addition & 0 deletions riddles/Bug/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bug
File renamed without changes.
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions riddles/Great!/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
camera
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions riddles/apple/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apple
File renamed without changes.
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions riddles/binary/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
binary
File renamed without changes.
File renamed without changes
1 change: 1 addition & 0 deletions riddles/bird/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bird
File renamed without changes.
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions riddles/c++/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
camera
File renamed without changes.
File renamed without changes
1 change: 1 addition & 0 deletions riddles/camera/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
camera
File renamed without changes.
File renamed without changes
1 change: 1 addition & 0 deletions riddles/complete/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
camera
File renamed without changes.
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions riddles/ctrl+s/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
camera
File renamed without changes.
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions riddles/ctrlplusz/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
camera
File renamed without changes.
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions riddles/death/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
camera
File renamed without changes.
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions riddles/fifa/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
camera
File renamed without changes.
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions riddles/firefox/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
camera
File renamed without changes.
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions riddles/floppy/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
camera
File renamed without changes.
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions riddles/html/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
camera
File renamed without changes.
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions riddles/javascript/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
camera
File renamed without changes.
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions riddles/kubernetes/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
camera
File renamed without changes.
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions riddles/manager/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
camera
File renamed without changes.
File renamed without changes
1 change: 1 addition & 0 deletions riddles/mega/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
camera
File renamed without changes.
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions riddles/no1/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
camera
File renamed without changes.
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions riddles/no2/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
camera
File renamed without changes.
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions riddles/no3/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
camera
File renamed without changes.
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions riddles/semicolon/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
camera
File renamed without changes.
File renamed without changes
1 change: 1 addition & 0 deletions riddles/std/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
camera
File renamed without changes.
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions riddles/ten/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
camera
File renamed without changes.
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions riddles/theQRshit/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
camera
File renamed without changes.
File renamed without changes
1 change: 1 addition & 0 deletions riddles/welcome_page/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
camera
File renamed without changes.
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions riddles/windows/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
camera
File renamed without changes.
2 changes: 2 additions & 0 deletions roles/build_images/files/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Dockerfile
conf
3 changes: 3 additions & 0 deletions roles/build_images/files/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM nginx
WORKDIR /usr/share/nginx/html
COPY . .
62 changes: 62 additions & 0 deletions roles/build_images/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---

# Ensure target directory exists

# - name: cat file
# shell: cat riddles/camera/index.html
# register: hostsfile

# - name: echo file
# debug:
# msg: "{{ hostsfile.stdout }}"


- name: install docker python module
pip:
name: docker

- name: copy Dockerfile to destination folder
copy:
src: Dockerfile
dest: "{{target_dir}}/{{ item.path }}/Dockerfile"
become: true
with_filetree: riddles/
when: item.state == 'directory'

- name: copy .dockerignore to destination folder
copy:
src: .dockerignore
dest: "{{target_dir}}/{{ item.path }}/.dockerignore"
become: true
with_filetree: riddles/
when: item.state == 'directory'

# - name: Get name of image
# shell: cat {{target_dir}}/camera/conf
# register: imagename

- name: build docker image
shell: "docker build {{target_dir}}/{{ item.path }}/ -t webhunt/$(cat {{target_dir}}/{{item.path}}/conf)"
become: true
with_filetree: riddles/
when: item.state == 'directory'


- name : delete Dockerfile from destination folder
file:
path: "{{target_dir}}/{{ item.path }}/Dockerfile"
state: absent
become: true
with_filetree: riddles/
when: item.state == 'directory'

- name : delete .dockerignore from destination folder
file:
path: "{{target_dir}}/{{ item.path }}/.dockerignore"
state: absent
become: true
with_filetree: riddles/
when: item.state == 'directory'



3 changes: 0 additions & 3 deletions semicolon/setting.json

This file was deleted.

3 changes: 0 additions & 3 deletions std/setting.json

This file was deleted.

3 changes: 0 additions & 3 deletions ten/setting.json

This file was deleted.

3 changes: 0 additions & 3 deletions theQRshit/setting.json

This file was deleted.

3 changes: 0 additions & 3 deletions welcome_page/setting.json

This file was deleted.

3 changes: 0 additions & 3 deletions windows/setting.json

This file was deleted.

0 comments on commit 010c159

Please sign in to comment.