Browse Source

Release, components and repos as build args

Andrey Volkov 6 months ago
parent
commit
1cf350e597
2 changed files with 14 additions and 11 deletions
  1. 8
    0
      Dockerfile
  2. 6
    11
      assets/update_mirror_ubuntu.sh

+ 8
- 0
Dockerfile View File

@@ -55,12 +55,20 @@ ARG EMAIL_ADDRESS="youremail@example.com"
55 55
 ARG GPG_PASSWORD="PickAPassword"
56 56
 ARG HOSTNAME=localhost
57 57
 ARG MODE=packages
58
+ARG UBUNTU_RELEASE=xenial
59
+ARG UPSTREAM_URL="http://archive.ubuntu.com/ubuntu/"
60
+ARG COMPONENTS="main universe"
61
+ARG REPOS="${UBUNTU_RELEASE} ${UBUNTU_RELEASE}-updates ${UBUNTU_RELEASE}-security"
58 62
 
59 63
 ENV FULL_NAME ${FULL_NAME}
60 64
 ENV EMAIL_ADDRESS ${EMAIL_ADDRESS}
61 65
 ENV GPG_PASSWORD ${GPG_PASSWORD}
62 66
 ENV HOSTNAME ${HOSTNAME}
63 67
 ENV MODE ${MODE}
68
+ENV UBUNTU_RELEASE=${UBUNTU_RELEASE}
69
+ENV UPSTREAM_URL=${UPSTREAM_URL}
70
+ENV COMPONENTS=${COMPONENTS}
71
+ENV REPOS=${REPOS}
64 72
 
65 73
 COPY assets/packages /opt/packages
66 74
 COPY assets/gpg/* /opt/aptly/

+ 6
- 11
assets/update_mirror_ubuntu.sh View File

@@ -11,11 +11,6 @@ set -x
11 11
 # For more detail about each of the variables below refer to:
12 12
 # https://help.ubuntu.com/community/Repositories/CommandLine
13 13
 
14
-UBUNTU_RELEASE=xenial
15
-UPSTREAM_URL="http://archive.ubuntu.com/ubuntu/"
16
-COMPONENTS=( main universe )
17
-REPOS=( ${UBUNTU_RELEASE} ${UBUNTU_RELEASE}-updates ${UBUNTU_RELEASE}-security )
18
-
19 14
 if [ "$MODE" = "packages" ]; then
20 15
     FILTER_OPTS=(-filter="$(cat /opt/packages | paste -sd \| -)" -filter-with-deps)
21 16
 else
@@ -24,8 +19,8 @@ fi
24 19
 
25 20
 # Create repository mirrors if they don't exist
26 21
 set +e
27
-for component in ${COMPONENTS[@]}; do
28
-  for repo in ${REPOS[@]}; do
22
+for component in ${COMPONENTS}; do
23
+  for repo in ${REPOS}; do
29 24
     aptly mirror list -raw | grep "^${repo}-${component}$"
30 25
     if [[ $? -ne 0 ]]; then
31 26
       echo "Creating mirror of ${repo}-${component} repository."
@@ -37,16 +32,16 @@ done
37 32
 set -e
38 33
 
39 34
 # Update all repository mirrors
40
-for component in ${COMPONENTS[@]}; do
41
-  for repo in ${REPOS[@]}; do
35
+for component in ${COMPONENTS}; do
36
+  for repo in ${REPOS}; do
42 37
     echo "Updating ${repo}-${component} repository mirror.."
43 38
     aptly mirror update ${repo}-${component}
44 39
   done
45 40
 done
46 41
 
47 42
 # Create snapshots of updated repositories
48
-for component in ${COMPONENTS[@]}; do
49
-  for repo in ${REPOS[@]}; do
43
+for component in ${COMPONENTS}; do
44
+  for repo in ${REPOS}; do
50 45
     echo "Creating snapshot of ${repo}-${component} repository mirror.."
51 46
     SNAPSHOTARRAY+="${repo}-${component}-`date +%Y%m%d%H` "
52 47
     aptly snapshot create ${repo}-${component}-`date +%Y%m%d%H` from mirror ${repo}-${component}

Loading…
Cancel
Save