From 55e1575a53fb44f790646ff5f82540a677151ee2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Bompard?= Date: Thu, 17 Sep 2020 11:44:47 +0200 Subject: [PATCH] Prevent Docker from caching the git clone content MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Aurélien Bompard --- playbooks/openshift-apps/fasjson.yml | 6 ++++++ roles/openshift-apps/fasjson/templates/Dockerfile | 3 +++ 2 files changed, 9 insertions(+) diff --git a/playbooks/openshift-apps/fasjson.yml b/playbooks/openshift-apps/fasjson.yml index bd62e7dbaf..8750472e0c 100644 --- a/playbooks/openshift-apps/fasjson.yml +++ b/playbooks/openshift-apps/fasjson.yml @@ -10,6 +10,12 @@ vars: + pre_tasks: + - name: create a file with random content to prevent docker from caching the git clone + copy: + dest: /etc/openshift_apps/fasjson/random-file + content: "{{ now() }}" + roles: - role: openshift/project app: fasjson diff --git a/roles/openshift-apps/fasjson/templates/Dockerfile b/roles/openshift-apps/fasjson/templates/Dockerfile index d57445e9fa..70d270c371 100644 --- a/roles/openshift-apps/fasjson/templates/Dockerfile +++ b/roles/openshift-apps/fasjson/templates/Dockerfile @@ -28,6 +28,9 @@ RUN dnf install -y \ python3-wheel && \ dnf autoremove -y && \ dnf clean all -y +# Add a file with random content to prevent Docker from caching the git clone step. +COPY random-file +RUN rm -f random-file RUN git clone https://github.com/fedora-infra/fasjson.git && \ pushd fasjson && \ git checkout {{ (env == 'production')|ternary('stable', 'staging') }} && \