Browse Source

Update images based on the one just built

master
meskio 3 years ago
parent
commit
33dd808dc8
Signed by: meskio
GPG Key ID: 52B8F5AC97A2DA86
  1. 5
      base_image.run
  2. 3
      build_image.run
  3. 11
      playbook.yml
  4. 12
      update_images

5
base_image.run

@ -1,4 +1,4 @@
#!/bin/bash -ex
#!/bin/bash -x
ROOTPATH="$WORKSPACE/rootfs"
PATH=$PATH:/usr/sbin
@ -22,7 +22,8 @@ sudo debuerreotype-minimizing-config ${ROOTPATH}
sudo debuerreotype-gen-sources-list ${ROOTPATH} stable 'http://deb.debian.org/debian' 'http://security.debian.org/debian-security'
sudo debuerreotype-tar ${ROOTPATH} - | docker import -c 'CMD ["bash"]' - ${image}
docker tag ${image} {{ registry_domain }}/${image}
docker tag ${image} {{ registry }}/${image}
docker push {{ registry }}/${image}
# TODO: rebuild dependent images
update_images ${image}

3
build_image.run

@ -9,5 +9,8 @@ do
done
docker build . -t ${image}
docker tag ${image} {{ registry_domain }}/${image}
docker tag ${image} {{ registry }}/${image}
docker push {{ registry }}/${image}
update_images ${image}

11
playbook.yml

@ -52,6 +52,7 @@
- nginx
- sudo
- debuerreotype
- jq
state: latest
- name: config docker registry
@ -118,6 +119,16 @@
regexp: '^laminar '
line: 'laminar ALL=(ALL) NOPASSWD: ALL'
- name: configure laminar scripts
template:
src: "{{ item }}"
dest: "{{ laminar_home }}/cfg/scripts/{{ item }}"
owner: laminar
group: laminar
mode: u=rwx,g=rwx,o=rx
with_items:
- update_images
- name: configure jobs
template:
src: "{{ item }}"

12
update_images

@ -0,0 +1,12 @@
#!/bin/bash -e
base="{{ registry_domain }}/$1"
for image in `curl -s -X GET {{ registry }}/v2/_catalog | jq -r '.repositories[]'`
do
docker_from=`curl -s {{ repos_url }}/${image}/raw/branch/master/Dockerfile |grep FROM |awk '{ print $2 }'`
if [ "$base" = "$docker_from" ]
then
build_image $image
fi
done
Loading…
Cancel
Save