Browse Source

Build base image

master
meskio 3 years ago
parent
commit
a20ee0a73a
Signed by: meskio
GPG Key ID: 52B8F5AC97A2DA86
  1. 26
      base_image.run
  2. 6
      nginx-registry
  3. 24
      playbook.yml
  4. 1
      vars.yml

26
base_image.run

@ -0,0 +1,26 @@
#!/bin/bash -ex
ROOTPATH="$WORKSPACE/rootfs"
FAKEROOT=fakechroot fakeroot
image="debian"
if [ -d ${ROOTPATH} ]
then
${FAKEROOT} chroot ${ROOTPATH} apt-get update
${FAKEROOT} chroot ${ROOTPATH} apt-get -s update --assume-no
if [ $? -eq 0 ]
then
echo "No updates needed"
exit 0
fi
rm -rf ${ROOTPATH}
fi
${FAKEROOT} /usr/sbin/debootstrap --force-check-gpg --variant=minbase --merged-usr stable ${ROOTPATH}
tar -C ${ROOTPATH} -c . | docker import -c 'CMD ["bash"]' - ${image}
docker tag ${image} {{ registry }}/${image}
docker push {{ registry }}/${image}
# TODO: rebuild dependent images

6
nginx-registry

@ -3,10 +3,10 @@ upstream docker-registry {
}
server {
listen 80 default_server;
listen [::]:80 default_server;
listen 80;
listen [::]:80;
server_name _;
server_name {{ registry_domain }};
# required to avoid HTTP 411: see Issue #1486 (https://github.com/moby/moby/issues/1486)
chunked_transfer_encoding on;

24
playbook.yml

@ -50,6 +50,9 @@
- docker.io
- docker-registry
- nginx
- fakeroot
- fakechroot
- debootstrap
state: latest
- name: config docker registry
@ -82,6 +85,12 @@
- name: enable nginx
service: name=nginx state=started enabled=yes
- name: add the registry to the host file
lineinfile:
dest: /etc/hosts
regexp: '.*{{ registry_domain }}$'
line: '127.0.0.1 {{ registry_domain }}'
- name: install laminar
apt:
# laminar is in it's way to get included in debian:
@ -103,17 +112,26 @@
- delete keyring
- import openpgp keys
- name: configure build image job
- name: configure jobs
template:
src: build_image.run
dest: "{{ laminar_home }}/cfg/jobs/build_image.run"
src: "{{ item }}"
dest: "{{ laminar_home }}/cfg/jobs/{{ item }}"
owner: laminar
group: laminar
mode: u=rwx,g=rwx,o=rx
with_items:
- build_image.run
- base_image.run
- name: enable laminar
service: name=laminar state=started enabled=yes
- name: set nightly base image rebuild
cron:
name: "rebuild base image"
hour: "3"
job: "/usr/bin/laminarc queue base_image"
- name: copy build_image script
copy:
src: build_image

1
vars.yml

@ -1,3 +1,4 @@
---
secret: "secret"
repos_url: "https://git.sindominio.net/estibadores"
registry_domain: "registry.sindominio.net"

Loading…
Cancel
Save