shaker/tools/playbooks/dockerhub_publish.yml
Ilya Shakhat 4b041b2b38 Add Zuul job to build Docker image
The job runs in gate pipeline. It creates a new image
and pushes it into performa/shaker repo on Dockerhub.

Change-Id: I85d26a03c812657138b2ceb2a0496ceb7d015577
2018-11-09 09:31:01 +01:00

25 lines
724 B
YAML

---
- hosts: all
tasks:
- name: Install Docker
apt:
name: docker.io
state: present
become: yes
- name: changing permission of Docker socket to 666
file:
path: /run/docker.sock
mode: 666
become: true
- name: Build a container
command: "docker build -t performa/shaker:latest {{ zuul.project.src_dir }}"
- name: Login to Dockerhub
command: "docker login -u {{ shaker_dockerhub_creds.user }} -p {{ shaker_dockerhub_creds.password }}"
no_log: true
- name: Push images to Dockerhub
shell: "for img in $(docker images --format '{% raw %}{{ .Repository }}:{{ .Tag }}{% endraw %}' | grep shaker ); do docker push $img; done"