-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
63 lines (43 loc) · 2.13 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Start from Debian stable (Stretch)
FROM debian:stable
# Add backports repository
RUN echo 'deb http://deb.debian.org/debian/ stretch-backports main contrib non-free' >>/etc/apt/sources.list
# Install the required package
RUN apt -qq update
# Create a dedicated user for simplecdd
RUN useradd -ms /bin/dash cdbuild
# Copy the SSH key into the misc directory, that will be put on the CD image
RUN mkdir -p /home/cdbuild/misc/root/.ssh
COPY --chown=cdbuild:cdbuild ./config/authorized_keys /home/cdbuild/misc/root/.ssh/authorized_keys
# Install the last version of simple-cdd and debian keyrings
RUN apt -qq install -t stretch-backports -y simple-cdd debian-archive-keyring
# Install the last version of ansible to build the preseed file
RUN apt -qq install -t stretch-backports -y ansible
# Remove expired keys from Debian keyring
RUN apt-key --keyring /usr/share/keyrings/debian-archive-keyring.gpg del ED6D65271AACF0FF15D123036FB2A1C265FFB764
# Copy the miscellaneous files to be part of the CD image
# but remove the doc file
COPY --chown=cdbuild:cdbuild ./misc /home/cdbuild/misc/
RUN rm -f /home/cdbuild/misc/readme.md
# Copy the playbooks and the configuration
COPY --chown=cdbuild:cdbuild ./playbooks /home/cdbuild/playbooks/
COPY --chown=cdbuild:cdbuild ./config /home/cdbuild/config/
# Build the ISO image
USER cdbuild
WORKDIR /home/cdbuild
# Copy the Ansible configuration file
COPY --chown=cdbuild:cdbuild ansible/ansible.cfg /home/cdbuild
# Create a simple host file for localhost to avoid Ansible warning
COPY --chown=cdbuild:cdbuild ansible/hosts.yml /home/cdbuild
# Run the ansible playbook
RUN ansible-playbook -vv -i hosts.yml -l localhost playbooks/docker.yml
# Build the mirror using simple-cdd
RUN cd /tmp/build-homebox && ./build-mirror.sh
# And build the CD image
RUN cd /tmp/build-homebox && ./build-cd.sh
# The ISO image is in this folder, but copying to the host
# seems unstable and problematic
RUN md5sum /home/cdbuild/debian-images/*iso
RUN test -d /tmp/debian-images/ || mkdir /tmp/debian-images/
RUN test -d /tmp/debian-images/isos || mkdir /tmp/debian-images/isos/
ENTRYPOINT cp /home/cdbuild/debian-images/* /tmp/debian-images/isos/