From d4475e6fb29aa3b0ed5e46f3f356040406f1a130 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sun, 15 Nov 2020 13:54:35 +0100 Subject: [PATCH] #7: Clean up --- .infrastructure/arm.Dockerfile | 12 +++++++----- entrypoint.sh => .infrastructure/entrypoint.sh | 0 .infrastructure/generate-requirements-txt.py | 17 ----------------- .infrastructure/notify.sh | 10 ---------- .../supervisord.conf | 0 .infrastructure/x86_64.Dockerfile | 9 ++++----- 6 files changed, 11 insertions(+), 37 deletions(-) rename entrypoint.sh => .infrastructure/entrypoint.sh (100%) delete mode 100755 .infrastructure/generate-requirements-txt.py delete mode 100755 .infrastructure/notify.sh rename supervisord.conf => .infrastructure/supervisord.conf (100%) diff --git a/.infrastructure/arm.Dockerfile b/.infrastructure/arm.Dockerfile index ff8eccc..179a552 100644 --- a/.infrastructure/arm.Dockerfile +++ b/.infrastructure/arm.Dockerfile @@ -22,11 +22,6 @@ RUN cd /infracheck \ && pip3 install pbr==5.4.5 \ && pip3 install -r /infracheck/requirements.txt \ && rkd :install \ - # after installing as package extract infrastructural files - \ - && cp -pr /infracheck/entrypoint.sh / \ - && cp -pr /infracheck/supervisord.conf /etc/supervisord.conf \ - && chmod +x /entrypoint.sh \ \ # delete the temporary directory after the application was installed via setuptools && rm -rf /infracheck \ @@ -37,4 +32,11 @@ RUN cd /infracheck \ && apk del BUILD_DEPS RUN [ "cross-build-end" ] +ADD /.infrastructure/entrypoint.sh /entrypoint.sh +ADD /.infrastructure/supervisord.conf /etc/supervisord.conf + +RUN [ "cross-build-start" ] +RUN chmod +x /entrypoint.sh +RUN [ "cross-build-end" ] + ENTRYPOINT ["/entrypoint.sh"] diff --git a/entrypoint.sh b/.infrastructure/entrypoint.sh similarity index 100% rename from entrypoint.sh rename to .infrastructure/entrypoint.sh diff --git a/.infrastructure/generate-requirements-txt.py b/.infrastructure/generate-requirements-txt.py deleted file mode 100755 index c8f92fa..0000000 --- a/.infrastructure/generate-requirements-txt.py +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env python3 - -import os -from json import loads as json_loads - -assert os.path.isfile('Pipfile.lock') - -requirements = "" - -with open('./Pipfile.lock', 'rb') as f: - piplock = f.read() - -for package_name, details in json_loads(piplock)['default'].items(): - requirements += package_name + details['version'] + "\n" - -with open('./requirements.txt', 'wb') as f: - f.write(requirements.encode('utf-8')) diff --git a/.infrastructure/notify.sh b/.infrastructure/notify.sh deleted file mode 100755 index 70de1cb..0000000 --- a/.infrastructure/notify.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -SLACK_URL=$1 -MESSAGE=$2 -MESSAGE=${MESSAGE/\[OK\]/:white_check_mark:} -MESSAGE=${MESSAGE/\[FAILURE\]/:exclamation:} - -[[ "$SLACK_URL" ]] && echo "{\"text\": \"[Travis-CI] ${MESSAGE}\"}" | curl -H 'Content-type: application/json' -d @- -X POST -s "${SLACK_URL}"; - -exit 0 diff --git a/supervisord.conf b/.infrastructure/supervisord.conf similarity index 100% rename from supervisord.conf rename to .infrastructure/supervisord.conf diff --git a/.infrastructure/x86_64.Dockerfile b/.infrastructure/x86_64.Dockerfile index 62b89b5..18777a2 100644 --- a/.infrastructure/x86_64.Dockerfile +++ b/.infrastructure/x86_64.Dockerfile @@ -19,11 +19,6 @@ RUN cd /infracheck \ && pip3 install pbr==5.4.5 \ && pip3 install -r /infracheck/requirements.txt \ && rkd :install \ - # after installing as package extract infrastructural files - \ - && cp -pr /infracheck/entrypoint.sh / \ - && cp -pr /infracheck/supervisord.conf /etc/supervisord.conf \ - && chmod +x /entrypoint.sh \ \ # delete the temporary directory after the application was installed via setuptools && rm -rf /infracheck \ @@ -33,4 +28,8 @@ RUN cd /infracheck \ \ && apk del BUILD_DEPS +ADD /.infrastructure/entrypoint.sh /entrypoint.sh +ADD /.infrastructure/supervisord.conf /etc/supervisord.conf +RUN chmod +x /entrypoint.sh + ENTRYPOINT ["/entrypoint.sh"]