Browse Source

Save ubuntu packages inside image

Andrey Volkov 6 months ago
parent
commit
d1689ae911
5 changed files with 632 additions and 18 deletions
  1. 11
    4
      Dockerfile
  2. 596
    0
      assets/packages
  3. 7
    0
      assets/run.sh
  4. 6
    9
      assets/startup.sh
  5. 12
    5
      assets/update_mirror_ubuntu.sh

+ 11
- 4
Dockerfile View File

@@ -16,7 +16,7 @@
16 16
 
17 17
 FROM ubuntu:xenial
18 18
 
19
-LABEL maintainer="urpylka@gmail.com"
19
+LABEL maintainer="airship-team@att.com"
20 20
 
21 21
 ENV DEBIAN_FRONTEND noninteractive
22 22
 
@@ -50,8 +50,15 @@ RUN rm /etc/nginx/sites-enabled/*
50 50
 COPY assets/supervisord.nginx.conf /etc/supervisor/conf.d/nginx.conf
51 51
 RUN echo "daemon off;" >> /etc/nginx/nginx.conf
52 52
 
53
-# Bind mount location
54
-VOLUME [ "/opt/aptly" ]
53
+ENV FULL_NAME="First Last"
54
+ENV EMAIL_ADDRESS="youremail@example.com"
55
+ENV GPG_PASSWORD="PickAPassword"
56
+ENV HOSTNAME=localhost
57
+
58
+COPY assets/packages /opt/packages
59
+
60
+RUN /opt/startup.sh
55 61
 
56 62
 # Execute Startup script when container starts
57
-ENTRYPOINT [ "/opt/startup.sh" ]
63
+
64
+CMD [ "/opt/run.sh" ]

+ 596
- 0
assets/packages View File

@@ -0,0 +1,596 @@
1
+accountsservice
2
+acl
3
+acpid
4
+adduser
5
+amd64-microcode
6
+apparmor
7
+apport
8
+apport-symptoms
9
+apt
10
+apt-transport-https
11
+apt-utils
12
+arping
13
+at
14
+base-files
15
+base-passwd
16
+bash
17
+bash-completion
18
+bc
19
+bcache-tools
20
+bind9-host
21
+binfmt-support
22
+binutils
23
+bsdmainutils
24
+bsdutils
25
+btrfs-tools
26
+build-essential
27
+busybox-initramfs
28
+busybox-static
29
+byobu
30
+bzip2
31
+ca-certificates
32
+ceph-common
33
+cloud-guest-utils
34
+cloud-init
35
+cloud-initramfs-copymods
36
+cloud-initramfs-dyn-netconf
37
+command-not-found
38
+command-not-found-data
39
+console-setup
40
+console-setup-linux
41
+coreutils
42
+cpio
43
+cpp
44
+cpp-5
45
+crda
46
+cron
47
+cryptsetup
48
+cryptsetup-bin
49
+curl
50
+dash
51
+dbus
52
+debconf
53
+debconf-i18n
54
+debianutils
55
+dh-python
56
+diffutils
57
+distro-info-data
58
+dkms
59
+dmeventd
60
+dmidecode
61
+dmsetup
62
+dnsmasq-base
63
+dns-root-data
64
+dnsutils
65
+docker.io
66
+docker-engine
67
+dosfstools
68
+dpkg
69
+dpkg-dev
70
+dstat
71
+e2fslibs
72
+e2fsprogs
73
+eatmydata
74
+ed
75
+eject
76
+ethtool
77
+fakeroot
78
+file
79
+findutils
80
+fonts-ubuntu-font-family-console
81
+freeipmi-common
82
+friendly-recovery
83
+ftp
84
+fuse
85
+g++
86
+g++-5
87
+gawk
88
+gcc
89
+gcc-5
90
+gcc-5-base
91
+gcc-6-base
92
+gdisk
93
+geoip-database
94
+gettext-base
95
+gir1.2-glib-2.0
96
+git
97
+git-man
98
+gnupg
99
+gpgv
100
+grep
101
+groff-base
102
+grub2-common
103
+grub-common
104
+grub-gfxpayload-lists
105
+grub-legacy-ec2
106
+grub-pc
107
+grub-pc-bin
108
+gzip
109
+hdparm
110
+heirloom-mailx
111
+hostname
112
+ifenslave
113
+ifupdown
114
+info
115
+init
116
+initramfs-tools
117
+initramfs-tools-bin
118
+initramfs-tools-core
119
+initscripts
120
+init-system-helpers
121
+insserv
122
+installation-report
123
+install-info
124
+intel-microcode
125
+iotop
126
+iperf
127
+ipmitool
128
+iproute2
129
+iptables
130
+iputils-arping
131
+iputils-ping
132
+iputils-tracepath
133
+irqbalance
134
+isc-dhcp-client
135
+isc-dhcp-common
136
+iso-codes
137
+iucode-tool
138
+iw
139
+jq
140
+kbd
141
+keyboard-configuration
142
+klibc-utils
143
+kmod
144
+krb5-locales
145
+ksh
146
+language-selector-common
147
+laptop-detect
148
+ldap-utils
149
+less
150
+libaccountsservice0
151
+libacl1
152
+libalgorithm-diff-perl
153
+libalgorithm-diff-xs-perl
154
+libalgorithm-merge-perl
155
+libapparmor1
156
+libapparmor-perl
157
+libapt-inst2.0
158
+libapt-pkg5.0
159
+libasan2
160
+libasn1-8-heimdal
161
+libasprintf0v5
162
+libatm1
163
+libatomic1
164
+libattr1
165
+libaudit1
166
+libaudit-common
167
+libbabeltrace1
168
+libbabeltrace-ctf1
169
+libbind9-140
170
+libblas3
171
+libblas-common
172
+libblkid1
173
+libboost-iostreams1.58.0
174
+libboost-program-options1.58.0
175
+libboost-random1.58.0
176
+libboost-regex1.58.0
177
+libboost-system1.58.0
178
+libboost-thread1.58.0
179
+libbsd0
180
+libbz2-1.0
181
+libc6
182
+libc6-dev
183
+libcap2
184
+libcap2-bin
185
+libcap-ng0
186
+libc-bin
187
+libcc1-0
188
+libc-dev-bin
189
+libcephfs1
190
+libcilkrts5
191
+libcomerr2
192
+libcryptsetup4
193
+libcurl3-gnutls
194
+libdb5.3
195
+libdbus-1-3
196
+libdbus-glib-1-2
197
+libdebconfclient0
198
+libdevmapper1.02.1
199
+libdevmapper-event1.02.1
200
+libdns162
201
+libdns-export162
202
+libdpkg-perl
203
+libdrm2
204
+libdrm-common
205
+libdumbnet1
206
+libdw1
207
+libeatmydata1
208
+libedit2
209
+libelf1
210
+liberror-perl
211
+libestr0
212
+libevent-2.0-5
213
+libexpat1
214
+libfakeroot
215
+libfcgi0ldbl
216
+libfdisk1
217
+libffi6
218
+libfile-fcntllock-perl
219
+libfreeipmi16
220
+libfreetype6
221
+libfribidi0
222
+libfuse2
223
+libgcc1
224
+libgcc-5-dev
225
+libgcrypt20
226
+libgdbm3
227
+libgeoip1
228
+libgirepository-1.0-1
229
+libglib2.0-0
230
+libglib2.0-data
231
+libgmp10
232
+libgnutls30
233
+libgnutls-openssl27
234
+libgomp1
235
+libgpg-error0
236
+libgpm2
237
+libgssapi3-heimdal
238
+libgssapi-krb5-2
239
+libhcrypto4-heimdal
240
+libheimbase1-heimdal
241
+libheimntlm0-heimdal
242
+libhogweed4
243
+libhx509-5-heimdal
244
+libicu55
245
+libidn11
246
+libisc160
247
+libisccc140
248
+libisccfg140
249
+libisc-export160
250
+libisl15
251
+libitm1
252
+libjansson4
253
+libjson-c2
254
+libk5crypto3
255
+libkeyutils1
256
+libklibc
257
+libkmod2
258
+libkrb5-26-heimdal
259
+libkrb5-3
260
+libkrb5support0
261
+libldap-2.4-2
262
+liblinear3
263
+liblocale-gettext-perl
264
+liblsan0
265
+libltdl7
266
+liblua5.2-0
267
+liblvm2app2.2
268
+liblvm2cmd2.02
269
+liblwres141
270
+liblxc1
271
+liblz4-1
272
+liblzma5
273
+liblzo2-2
274
+libmagic1
275
+libmnl0
276
+libmount1
277
+libmpc3
278
+libmpdec2
279
+libmpfr4
280
+libmpx0
281
+libmspack0
282
+libncurses5
283
+libncursesw5
284
+libnet1
285
+libnetfilter-conntrack3
286
+libnettle6
287
+libnewt0.52
288
+libnfnetlink0
289
+libnih1
290
+libnl-3-200
291
+libnl-genl-3-200
292
+libnspr4
293
+libnss3
294
+libnss3-nssdb
295
+libnuma1
296
+libonig2
297
+libopenipmi0
298
+libopts25
299
+libp11-kit0
300
+libpam0g
301
+libpam-modules
302
+libpam-modules-bin
303
+libpam-runtime
304
+libpam-systemd
305
+libparted2
306
+libpcap0.8
307
+libpci3
308
+libpcre3
309
+libperl5.22
310
+libpipeline1
311
+libplymouth4
312
+libpng12-0
313
+libpolkit-agent-1-0
314
+libpolkit-backend-1-0
315
+libpolkit-gobject-1-0
316
+libpopt0
317
+libprocps4
318
+libprotobuf9v5
319
+libpython2.7-minimal
320
+libpython2.7-stdlib
321
+libpython3.5
322
+libpython3.5-minimal
323
+libpython3.5-stdlib
324
+libpython3-stdlib
325
+libpython-stdlib
326
+libquadmath0
327
+librados2
328
+libradosstriper1
329
+librbd1
330
+libreadline5
331
+libreadline6
332
+librgw2
333
+libroken18-heimdal
334
+librtmp1
335
+libsasl2-2
336
+libsasl2-modules
337
+libsasl2-modules-db
338
+libseccomp2
339
+libselinux1
340
+libsemanage1
341
+libsemanage-common
342
+libsensors4
343
+libsepol1
344
+libsigsegv2
345
+libslang2
346
+libsmartcols1
347
+libsnmp30
348
+libsnmp-base
349
+libsqlite3-0
350
+libss2
351
+libssl1.0.0
352
+libstdc++-5-dev
353
+libstdc++6
354
+libsystemd0
355
+libtasn1-6
356
+libtext-charwidth-perl
357
+libtext-iconv-perl
358
+libtext-wrapi18n-perl
359
+libtinfo5
360
+libtsan0
361
+libubsan0
362
+libudev1
363
+libunwind8
364
+libusb-0.1-4
365
+libusb-1.0-0
366
+libustr-1.0-1
367
+libutempter0
368
+libuuid1
369
+libuv1
370
+libwind0-heimdal
371
+libwrap0
372
+libx11-6
373
+libx11-data
374
+libxau6
375
+libxcb1
376
+libxdmcp6
377
+libxext6
378
+libxml2
379
+libxmlsec1
380
+libxmlsec1-openssl
381
+libxmuu1
382
+libxslt1.1
383
+libxtables11
384
+libyaml-0-2
385
+linux-base
386
+linux-cloud-tools-common
387
+linux-firmware
388
+linux-generic-hwe-16.04
389
+linux-headers-4.15.0-34
390
+linux-headers-4.15.0-34-generic
391
+linux-headers-generic-hwe-16.04
392
+linux-image-4.15.0-34-generic
393
+linux-image-extra-4.13.0-45-generic
394
+linux-image-generic-hwe-16.04
395
+linux-libc-dev
396
+linux-modules-4.15.0-34-generic
397
+linux-modules-extra-4.15.0-34-generic
398
+linux-signed-generic-hwe-16.04
399
+linux-signed-image-4.13.0-45-generic
400
+linux-tools-common
401
+lldpd
402
+locales
403
+login
404
+logrotate
405
+lsb-base
406
+lsb-release
407
+lshw
408
+lsof
409
+ltrace
410
+lua-lpeg
411
+lvm2
412
+lxc-common
413
+lxcfs
414
+lxd
415
+lxd-client
416
+make
417
+makedev
418
+man-db
419
+manpages
420
+manpages-dev
421
+mawk
422
+mdadm
423
+mime-support
424
+mlocate
425
+mosh
426
+mount
427
+mtr-tiny
428
+multiarch-support
429
+nano
430
+ncurses-base
431
+ncurses-bin
432
+ncurses-term
433
+ndiff
434
+netbase
435
+netcat-openbsd
436
+net-tools
437
+nmap
438
+node-commander
439
+nodejs
440
+node-nan
441
+node-tinycolor
442
+node-ws
443
+ntfs-3g
444
+ntp
445
+openipmi
446
+open-iscsi
447
+openssh-client
448
+openssh-server
449
+openssh-sftp-server
450
+openssl
451
+open-vm-tools
452
+os-prober
453
+overlayroot
454
+parted
455
+passwd
456
+pastebinit
457
+patch
458
+pciutils
459
+perl
460
+perl-base
461
+perl-modules-5.22
462
+plymouth
463
+plymouth-theme-ubuntu-text
464
+policykit-1
465
+pollinate
466
+popularity-contest
467
+powermgmt-base
468
+procps
469
+psmisc
470
+python
471
+python2.7
472
+python2.7-minimal
473
+python3
474
+python3.5
475
+python3.5-minimal
476
+python3-apport
477
+python3-apt
478
+python3-blinker
479
+python3-cffi-backend
480
+python3-chardet
481
+python3-commandnotfound
482
+python3-configobj
483
+python3-cryptography
484
+python3-dbus
485
+python3-debian
486
+python3-distupgrade
487
+python3-gdbm
488
+python3-gi
489
+python3-idna
490
+python3-jinja2
491
+python3-jsonpatch
492
+python3-json-pointer
493
+python3-jwt
494
+python3-markupsafe
495
+python3-minimal
496
+python3-newt
497
+python3-oauthlib
498
+python3-pkg-resources
499
+python3-prettytable
500
+python3-problem-report
501
+python3-pyasn1
502
+python3-pycurl
503
+python3-requests
504
+python3-serial
505
+python3-six
506
+python3-software-properties
507
+python3-systemd
508
+python3-update-manager
509
+python3-urllib3
510
+python3-yaml
511
+python-apt
512
+python-apt-common
513
+python-bs4
514
+python-cephfs
515
+python-chardet
516
+python-html5lib
517
+python-lxml
518
+python-minimal
519
+python-pkg-resources
520
+python-rados
521
+python-rbd
522
+python-requests
523
+python-six
524
+python-urllib3
525
+readline-common
526
+rename
527
+resolvconf
528
+rsync
529
+rsyslog
530
+run-one
531
+sbsigntool
532
+screen
533
+sed
534
+sensible-utils
535
+sgml-base
536
+shared-mime-info
537
+s-nail
538
+snapd
539
+socat
540
+software-properties-common
541
+sosreport
542
+squashfs-tools
543
+ssh-import-id
544
+ssmtp
545
+strace
546
+sudo
547
+sysstat
548
+systemd
549
+systemd-sysv
550
+sysvinit-utils
551
+sysv-rc
552
+tar
553
+tasksel
554
+tasksel-data
555
+tcpd
556
+tcpdump
557
+telnet
558
+thermald
559
+time
560
+tmux
561
+traceroute
562
+tzdata
563
+ubuntu-cloudimage-keyring
564
+ubuntu-core-launcher
565
+ubuntu-keyring
566
+ubuntu-minimal
567
+ubuntu-release-upgrader-core
568
+ubuntu-standard
569
+ucf
570
+udev
571
+ufw
572
+uidmap
573
+unattended-upgrades
574
+unzip
575
+update-manager-core
576
+update-notifier-common
577
+ureadahead
578
+usbutils
579
+util-linux
580
+uuid-runtime
581
+vim
582
+vim-common
583
+vim-runtime
584
+vim-tiny
585
+vlan
586
+wget
587
+whiptail
588
+wireless-regdb
589
+xauth
590
+xdg-user-dirs
591
+xfsprogs
592
+xkb-data
593
+xml-core
594
+xz-utils
595
+zerofree
596
+zlib1g

+ 7
- 0
assets/run.sh View File

@@ -0,0 +1,7 @@
1
+#!/usr/bin/env bash
2
+
3
+set -o pipefail
4
+set -o errexit
5
+# set -o xtrace
6
+
7
+/usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf

+ 6
- 9
assets/startup.sh View File

@@ -5,6 +5,8 @@
5 5
 # Copyright 2016 Bryan J. Hong
6 6
 # Licensed under the Apache License, Version 2.0
7 7
 
8
+set -o xtrace
9
+
8 10
 if [[ ! -f /root/.gnupg/gpg.conf ]]; then
9 11
   /opt/gpg.conf.sh
10 12
 fi
@@ -14,19 +16,15 @@ if [[ ! -f /opt/aptly/aptly.sec ]] || [[ ! -f /opt/aptly/aptly.pub ]]; then
14 16
   echo "Generating new gpg keys"
15 17
   cp -a /dev/urandom /dev/random
16 18
   /opt/gpg_batch.sh
19
+  mkdir -p /opt/aptly
17 20
   # If your system doesn't have a lot of entropy this may, take a long time
18 21
   # Google how-to create "artificial" entropy if this gets stuck
19
-  gpg --batch --gen-key /opt/gpg_batch
22
+  gpg -v --batch --gen-key /opt/gpg_batch
23
+
20 24
 else
21 25
   echo "No need to generate new gpg keys"
22 26
 fi
23 27
 
24
-# Export the GPG Public key
25
-if [[ ! -f /opt/aptly/public/aptly_repo_signing.key ]]; then
26
-  mkdir -p /opt/aptly/public
27
-  gpg --export --armor > /opt/aptly/public/aptly_repo_signing.key
28
-fi
29
-
30 28
 # Import Ubuntu keyrings if they exist
31 29
 if [[ -f /usr/share/keyrings/ubuntu-archive-keyring.gpg ]]; then
32 30
   gpg --list-keys
@@ -56,5 +54,4 @@ ln -sf /opt/aptly/aptly.pub /root/.gnupg/pubring.gpg
56 54
 # Generate Nginx Config
57 55
 /opt/nginx.conf.sh
58 56
 
59
-# Start Supervisor
60
-/usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf
57
+/opt/update_mirror_ubuntu.sh

+ 12
- 5
assets/update_mirror_ubuntu.sh View File

@@ -1,19 +1,26 @@
1 1
 #! /usr/bin/env bash
2 2
 set -e
3
+set -x
3 4
 
4 5
 # Automate the initial creation and update of an Ubuntu package mirror in aptly
5 6
 
6
-# The variables (as set below) will create a mirror of the Ubuntu Trusty repo 
7
+# The variables (as set below) will create a mirror of the Ubuntu repo
7 8
 # with the main & universe components, you can add other components like restricted
8 9
 # multiverse etc by adding to the array (separated by spaces).
9 10
 
10
-# For more detail about each of the variables below refer to: 
11
+# For more detail about each of the variables below refer to:
11 12
 # https://help.ubuntu.com/community/Repositories/CommandLine
12 13
 
13
-UBUNTU_RELEASE=bionic
14
+UBUNTU_RELEASE=xenial
14 15
 UPSTREAM_URL="http://archive.ubuntu.com/ubuntu/"
15 16
 COMPONENTS=( main universe )
16 17
 REPOS=( ${UBUNTU_RELEASE} ${UBUNTU_RELEASE}-updates ${UBUNTU_RELEASE}-security )
18
+MODE='packages' # packages - mirror specified packages or all
19
+if [ "$MODE" = "packages" ]; then
20
+    FILTER_OPTS=(-filter="$(cat /opt/packages | paste -sd \| -)" -filter-with-deps)
21
+else
22
+    FILTER_OPTS=()
23
+fi
17 24
 
18 25
 # Create repository mirrors if they don't exist
19 26
 set +e
@@ -23,7 +30,7 @@ for component in ${COMPONENTS[@]}; do
23 30
     if [[ $? -ne 0 ]]; then
24 31
       echo "Creating mirror of ${repo}-${component} repository."
25 32
       aptly mirror create \
26
-        -architectures=amd64 ${repo}-${component} ${UPSTREAM_URL} ${repo} ${component}
33
+        -architectures=amd64 "${FILTER_OPTS[@]}" ${repo}-${component} ${UPSTREAM_URL} ${repo} ${component}
27 34
     fi
28 35
   done
29 36
 done
@@ -49,7 +56,7 @@ done
49 56
 echo ${SNAPSHOTARRAY[@]}
50 57
 
51 58
 # Merge snapshots into a single snapshot with updates applied
52
-echo "Merging snapshots into one.." 
59
+echo "Merging snapshots into one.."
53 60
 aptly snapshot merge -latest                 \
54 61
   ${UBUNTU_RELEASE}-merged-`date +%Y%m%d%H`  \
55 62
   ${SNAPSHOTARRAY[@]}

Loading…
Cancel
Save