From 91e4555bde9d91c8161b517341735670221f15b5 Mon Sep 17 00:00:00 2001 From: Steve Baker Date: Fri, 11 May 2018 13:08:58 +1200 Subject: [PATCH] Detect local file repos and copy them into the image --- tasks/yum_update.yml | 22 ++++++++++++++++++++++ templates/Dockerfile.j2 | 1 + 2 files changed, 23 insertions(+) diff --git a/tasks/yum_update.yml b/tasks/yum_update.yml index b150442..a09dcee 100644 --- a/tasks/yum_update.yml +++ b/tasks/yum_update.yml @@ -28,6 +28,28 @@ dest: "{{ modify_dir_path }}/yum.repos.d" when: yum_repos_dir_path is defined +- name: Copy local file repos to context directory + shell: | + #!/bin/sh + set -ex + + # discover repos with local packages + repos=$(sed -n 's/baseurl=file:\/\///p' {{ yum_repos_dir_path }}/*.repo) + + mkdir repos + for repo in $repos ; do + if [ -d $repo ]; then + target_dir=repos$repo + echo "copying $repo to $target_dir" + mkdir -p $target_dir + cp -a $repo/* $target_dir + fi + done + args: + chdir: "{{ modify_dir_path }}" + when: yum_repos_dir_path is defined + + - name: Generate host package json file block: diff --git a/templates/Dockerfile.j2 b/templates/Dockerfile.j2 index 00ad633..93f4a79 100644 --- a/templates/Dockerfile.j2 +++ b/templates/Dockerfile.j2 @@ -8,6 +8,7 @@ COPY compare-package-json.py /tmp/ {% if yum_repos_dir_path is defined %} COPY yum.repos.d /etc/ +COPY repos / {% endif %} {% if compare_host_packages %}