From 3c061f0f089c512402da399500c0004079c7dbd3 Mon Sep 17 00:00:00 2001 From: Boris Glimcher Date: Tue, 17 Oct 2023 04:29:18 +0300 Subject: [PATCH] feat: move images to their own folder Signed-off-by: Boris Glimcher --- docker-compose.yml | 2 +- scripts/change_image.sh | 2 +- .../config => scripts/images}/my-boot-image.img | Bin sztp-server/Dockerfile | 3 ++- 4 files changed, 4 insertions(+), 3 deletions(-) rename {sztp-server/config => scripts/images}/my-boot-image.img (100%) diff --git a/docker-compose.yml b/docker-compose.yml index c3472513..90a60f5d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -82,7 +82,7 @@ services: web: image: docker.io/library/httpd:2.4.57-alpine3.17 volumes: - - ./sztp-server/config/my-boot-image.img:/usr/local/apache2/htdocs/my-boot-image.img + - ./sztp-server/images:/usr/local/apache2/htdocs ports: - 80:80 networks: diff --git a/scripts/change_image.sh b/scripts/change_image.sh index 83123282..4ecf96a6 100755 --- a/scripts/change_image.sh +++ b/scripts/change_image.sh @@ -14,7 +14,7 @@ sleep 5 docker-compose ps # define values -BOOT_IMG_FULL_PATH=../sztp-server/conf/my-second-boot-image.img +BOOT_IMG_FULL_PATH=../sztp-server/images/my-second-boot-image.img BOOTSTRAP_URL=http://localhost:7080/restconf/ds/ietf-datastores:running BOOT_IMG_PATH=$(basename ${BOOT_IMG_FULL_PATH}) BOOT_IMG_HASH_VAL=`openssl dgst -sha256 -c ${BOOT_IMG_FULL_PATH} | awk '{print $2}'` diff --git a/sztp-server/config/my-boot-image.img b/scripts/images/my-boot-image.img similarity index 100% rename from sztp-server/config/my-boot-image.img rename to scripts/images/my-boot-image.img diff --git a/sztp-server/Dockerfile b/sztp-server/Dockerfile index 2a16dd53..b66c3d4b 100644 --- a/sztp-server/Dockerfile +++ b/sztp-server/Dockerfile @@ -24,6 +24,7 @@ RUN echo "DNS.2 = bootstrap" >> sztpd1/sbi/end-entity/openssl.cnf && \ # configurations, images, templates COPY config/ /tmp/ +COPY images/ /media/ # generate static template @@ -35,7 +36,7 @@ RUN \ BOOTSVR_TA_CERT_B64=`openssl enc -base64 -A -in /tmp/ta_cert_chain.cms` \ CLIENT_CERT_TA_B64=`openssl enc -base64 -A -in /tmp/ta_cert_chain.cms` \ envsubst '$CLIENT_CERT_TA_B64,$SBI_PRI_KEY_B64,$SBI_PUB_KEY_B64,$SBI_EE_CERT_B64,$BOOTSVR_TA_CERT_B64' < /tmp/sztpd.redirect.json.template > /tmp/redirect.json.static && \ - BOOT_IMG_HASH_VAL=`openssl dgst -sha256 -c /tmp/my-boot-image.img | awk '{print $2}'` \ + BOOT_IMG_HASH_VAL=`openssl dgst -sha256 -c /media/my-boot-image.img | awk '{print $2}'` \ PRE_SCRIPT_B64=`openssl enc -base64 -A -in /tmp/my-pre-configuration-script.sh` \ POST_SCRIPT_B64=`openssl enc -base64 -A -in /tmp/my-post-configuration-script.sh` \ CONFIG_B64=`openssl enc -base64 -A -in /tmp/my-configuration.xml` \