Browse Source

Link to package file as a build arg

Andrey Volkov 6 months ago
parent
commit
b573730642
4 changed files with 14 additions and 8 deletions
  1. 3
    1
      Dockerfile
  2. 6
    6
      Vagrantfile
  3. 0
    0
      assets/packages/default
  4. 5
    1
      assets/update_mirror_ubuntu.sh

+ 3
- 1
Dockerfile View File

@@ -55,6 +55,7 @@ ARG EMAIL_ADDRESS="youremail@example.com"
55 55
 ARG GPG_PASSWORD="PickAPassword"
56 56
 ARG HOSTNAME=localhost
57 57
 ARG MODE=packages
58
+ARG PACKAGE_FILE=default
58 59
 ARG UBUNTU_RELEASE=xenial
59 60
 ARG UPSTREAM_URL="http://archive.ubuntu.com/ubuntu/"
60 61
 ARG COMPONENTS="main universe"
@@ -65,12 +66,13 @@ ENV EMAIL_ADDRESS ${EMAIL_ADDRESS}
65 66
 ENV GPG_PASSWORD ${GPG_PASSWORD}
66 67
 ENV HOSTNAME ${HOSTNAME}
67 68
 ENV MODE ${MODE}
69
+ENV PACKAGE_FILE=${PACKAGE_FILE}
68 70
 ENV UBUNTU_RELEASE=${UBUNTU_RELEASE}
69 71
 ENV UPSTREAM_URL=${UPSTREAM_URL}
70 72
 ENV COMPONENTS=${COMPONENTS}
71 73
 ENV REPOS=${REPOS}
72 74
 
73
-COPY assets/packages /opt/packages
75
+COPY assets/packages/* /opt/packages/
74 76
 COPY assets/gpg/* /opt/aptly/
75 77
 
76 78
 RUN /opt/startup.sh

+ 6
- 6
Vagrantfile View File

@@ -82,15 +82,15 @@ Vagrant.configure("2") do |config|
82 82
     node.vm.provision "file", source: ".", destination: "$HOME/docker-aptly"
83 83
 
84 84
     node.vm.provision :shell, inline: <<-SHELL
85
-       echo htop > /home/vagrant/docker-aptly/assets/packages
86
-       echo telnetd >> /home/vagrant/docker-aptly/assets/packages
87
-       echo openbsd-inetd >> /home/vagrant/docker-aptly/assets/packages
88
-       echo inet-superserver >> /home/vagrant/docker-aptly/assets/packages
89
-       echo 'mysql-client (>= 3.6)' >> /home/vagrant/docker-aptly/assets/packages
85
+       echo htop > /home/vagrant/docker-aptly/assets/packages/list
86
+       echo telnetd >> /home/vagrant/docker-aptly/assets/packages/list
87
+       echo openbsd-inetd >> /home/vagrant/docker-aptly/assets/packages/list
88
+       echo inet-superserver >> /home/vagrant/docker-aptly/assets/packages/list
89
+       echo 'mysql-client (>= 3.6)' >> /home/vagrant/docker-aptly/assets/packages/list
90 90
     SHELL
91 91
 
92 92
     node.vm.provision "docker" do |d|
93
-      d.build_image "/home/vagrant/docker-aptly -t aptly:test"
93
+      d.build_image "/home/vagrant/docker-aptly -t aptly:test --build-arg PACKAGE_FILE=list"
94 94
       d.run "aptly",
95 95
             args: "-p '8080:80' -v '/home/vagrant/docker-aptly/assets/nginx:/opt/nginx'",
96 96
             image: "aptly:test"

assets/packages → assets/packages/default View File


+ 5
- 1
assets/update_mirror_ubuntu.sh View File

@@ -12,7 +12,11 @@ set -x
12 12
 # https://help.ubuntu.com/community/Repositories/CommandLine
13 13
 
14 14
 if [ "$MODE" = "packages" ]; then
15
-    FILTER_OPTS=(-filter="$(cat /opt/packages | paste -sd \| -)" -filter-with-deps)
15
+    if [ ! -f "/opt/packages/$PACKAGE_FILE" ]; then
16
+        echo "File with a package list is not found"
17
+        exit 1
18
+    fi
19
+    FILTER_OPTS=(-filter="$(cat /opt/packages/$PACKAGE_FILE | paste -sd \| -)" -filter-with-deps)
16 20
 else
17 21
     FILTER_OPTS=()
18 22
 fi

Loading…
Cancel
Save