Browse Source

Use sudo+debuerreotype to generate base images

master
meskio 3 years ago
parent
commit
f46350ad32
Signed by: meskio
GPG Key ID: 52B8F5AC97A2DA86
  1. 14
      base_image.run
  2. 12
      playbook.yml

14
base_image.run

@ -1,25 +1,27 @@
#!/bin/bash -ex
ROOTPATH="$WORKSPACE/rootfs"
FAKEROOT=fakechroot fakeroot
PATH=$PATH:/usr/sbin
image="debian"
if [ -d ${ROOTPATH} ]
then
${FAKEROOT} chroot ${ROOTPATH} apt-get update
${FAKEROOT} chroot ${ROOTPATH} apt-get update --assume-no
sudo debuerreotype-apt-get ${ROOTPATH} update
sudo debuerreotype-apt-get ${ROOTPATH} upgrade --assume-no
if [ $? -eq 0 ]
then
echo "No updates needed"
exit 0
fi
rm -rf ${ROOTPATH}
sudo rm -rf ${ROOTPATH}
fi
${FAKEROOT} /usr/sbin/debootstrap --force-check-gpg --variant=minbase --merged-usr stable ${ROOTPATH}
sudo debuerreotype-init ${ROOTPATH} stable `date +%FT%T`
sudo debuerreotype-minimizing-config ${ROOTPATH}
sudo debuerreotype-gen-sources-list ${ROOTPATH} stable 'http://deb.debian.org/debian' 'http://security.debian.org/debian-security'
tar -C ${ROOTPATH} -c . | docker import -c 'CMD ["bash"]' - ${image}
sudo debuerreotype-tar ${ROOTPATH} - | docker import -c 'CMD ["bash"]' - ${image}
docker tag ${image} {{ registry }}/${image}
docker push {{ registry }}/${image}

12
playbook.yml

@ -50,9 +50,8 @@
- docker.io
- docker-registry
- nginx
- fakeroot
- fakechroot
- debootstrap
- sudo
- debuerreotype
state: latest
- name: config docker registry
@ -112,6 +111,13 @@
- delete keyring
- import openpgp keys
- name: give laminar sudo rights
# FIXME: will be nice to give more granular access
lineinfile:
dest: /etc/sudoers
regexp: '^laminar '
line: 'laminar ALL=(ALL) NOPASSWD: ALL'
- name: configure jobs
template:
src: "{{ item }}"

Loading…
Cancel
Save