Change in docker-playground[master]: Make respawn.sh a common part of *-build/-obs images

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

fixeria gerrit-no-reply at lists.osmocom.org
Thu Mar 11 14:07:47 UTC 2021


fixeria has submitted this change. ( https://gerrit.osmocom.org/c/docker-playground/+/23303 )

Change subject: Make respawn.sh a common part of *-build/-obs images
......................................................................

Make respawn.sh a common part of *-build/-obs images

Maintaining several versions of the same file in different folders
is a bad idea, because at some point their content gets out of sync.
This is exactly what happened to 'respawn.sh': sleep()ing was only
implemented in 'osmo-bts-master/respawn.sh', other versions of this
file would simply ignore '$SLEEP_BEFORE_RESPAWN'.

The easiest solution would be to have all common files in a single
directory, however Docker does not allow to ADD files from outside
of the build context.  In other words, all files must be in the
same directory as the Dockerfile itself.

Modify 'make/Makefile' in order to copy the contents of common
directory to the current build context ('pre-build' target) and
remove it after building ('post-build' target).

Change-Id: I3ec86c8610b3b43d39ea8e3da444861d317ced4e
---
M .gitignore
M centos8-build/Dockerfile
M centos8-obs-latest/Dockerfile
R common/respawn.sh
M debian-buster-build/Dockerfile
M debian-jessie-build/Dockerfile
M debian-sid-build/Dockerfile
M debian-stretch-obs-latest/Dockerfile
M make/Makefile
M osmo-bts-latest/Dockerfile
D osmo-bts-latest/respawn.sh
M osmo-bts-master/Dockerfile
M osmo-pcu-latest/Dockerfile
D osmo-pcu-latest/respawn.sh
M osmo-pcu-master/Dockerfile
D osmo-pcu-master/respawn.sh
16 files changed, 22 insertions(+), 53 deletions(-)

Approvals:
  osmith: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved
  fixeria: Verified



diff --git a/.gitignore b/.gitignore
index 0aba0f6..386d3f8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 .release
+.common
 
 /_cache
diff --git a/centos8-build/Dockerfile b/centos8-build/Dockerfile
index 412816c..001c161 100644
--- a/centos8-build/Dockerfile
+++ b/centos8-build/Dockerfile
@@ -50,5 +50,8 @@
 		sqlite-devel \
 		telnet
 
+# Make respawn.sh part of this image, so it can be used by other images based on it
+COPY	.common/respawn.sh /usr/local/bin/respawn.sh
+
 # Invalidate cache once the repository is updated
 ADD	$OSMOCOM_REPO_MIRROR/repositories/network:/osmocom:/latest/CentOS_8/repodata/repomd.xml /tmp/repomd.xml
diff --git a/centos8-obs-latest/Dockerfile b/centos8-obs-latest/Dockerfile
index 4b2357b..a9dfc9b 100644
--- a/centos8-obs-latest/Dockerfile
+++ b/centos8-obs-latest/Dockerfile
@@ -17,5 +17,8 @@
 RUN	dnf install -y \
 		telnet
 
+# Make respawn.sh part of this image, so it can be used by other images based on it
+COPY	.common/respawn.sh /usr/local/bin/respawn.sh
+
 # Invalidate cache once the repository is updated
 ADD	$OSMOCOM_REPO_MIRROR/repositories/network:/osmocom:/latest/CentOS_8/repodata/repomd.xml /tmp/repomd.xml
diff --git a/osmo-bts-master/respawn.sh b/common/respawn.sh
similarity index 100%
rename from osmo-bts-master/respawn.sh
rename to common/respawn.sh
diff --git a/debian-buster-build/Dockerfile b/debian-buster-build/Dockerfile
index 119afea..2625e9e 100644
--- a/debian-buster-build/Dockerfile
+++ b/debian-buster-build/Dockerfile
@@ -52,3 +52,6 @@
 		stow \
 		wget && \
 	apt-get clean
+
+# Make respawn.sh part of this image, so it can be used by other images based on it
+COPY	.common/respawn.sh /usr/local/bin/respawn.sh
diff --git a/debian-jessie-build/Dockerfile b/debian-jessie-build/Dockerfile
index 60f6ca9..b043762 100644
--- a/debian-jessie-build/Dockerfile
+++ b/debian-jessie-build/Dockerfile
@@ -52,3 +52,6 @@
 		stow \
 		wget && \
 	apt-get clean
+
+# Make respawn.sh part of this image, so it can be used by other images based on it
+COPY	.common/respawn.sh /usr/local/bin/respawn.sh
diff --git a/debian-sid-build/Dockerfile b/debian-sid-build/Dockerfile
index ffa86e2..f4fe990 100644
--- a/debian-sid-build/Dockerfile
+++ b/debian-sid-build/Dockerfile
@@ -50,3 +50,6 @@
 		sqlite3 \
 		wget && \
 	apt-get clean
+
+# Make respawn.sh part of this image, so it can be used by other images based on it
+COPY	.common/respawn.sh /usr/local/bin/respawn.sh
diff --git a/debian-stretch-obs-latest/Dockerfile b/debian-stretch-obs-latest/Dockerfile
index 3bef05c..04f831d 100644
--- a/debian-stretch-obs-latest/Dockerfile
+++ b/debian-stretch-obs-latest/Dockerfile
@@ -18,5 +18,8 @@
 	rm /tmp/Release.key && \
 	echo "deb " $OSMOCOM_REPO " ./" > /etc/apt/sources.list.d/osmocom-latest.list
 
+# Make respawn.sh part of this image, so it can be used by other images based on it
+COPY	.common/respawn.sh /usr/local/bin/respawn.sh
+
 # Invalidate cache once the repository is updated
 ADD	$OSMOCOM_REPO/Release /tmp/Release
diff --git a/make/Makefile b/make/Makefile
index f149291..d2cacf3 100644
--- a/make/Makefile
+++ b/make/Makefile
@@ -55,9 +55,12 @@
 build: pre-build docker-build post-build
 
 pre-build:
+	rm -rf .common
+	cp -r $(ROOT_DIR)/common .common
 
 
 post-build:
+	rm -rf .common
 
 
 post-push:
diff --git a/osmo-bts-latest/Dockerfile b/osmo-bts-latest/Dockerfile
index 202a29c..2b41968 100644
--- a/osmo-bts-latest/Dockerfile
+++ b/osmo-bts-latest/Dockerfile
@@ -20,8 +20,6 @@
 		;; \
 	esac
 
-ADD	respawn.sh /usr/local/bin/respawn.sh
-
 WORKDIR	/tmp
 
 VOLUME	/data
diff --git a/osmo-bts-latest/respawn.sh b/osmo-bts-latest/respawn.sh
deleted file mode 100755
index 2413916..0000000
--- a/osmo-bts-latest/respawn.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-trap "kill 0" EXIT
-
-i=0
-max_i=500
-while [ $i -lt $max_i ]; do
-	echo "$i: starting: $*"
-	$* &
-	LAST_PID=$!
-	wait $LAST_PID
-	echo "$i: stopped pid $LAST_PID with status $?"
-	i=$(expr $i + 1)
-done
-echo "exiting after $max_i runs"
diff --git a/osmo-bts-master/Dockerfile b/osmo-bts-master/Dockerfile
index 13df628..77c1e51 100644
--- a/osmo-bts-master/Dockerfile
+++ b/osmo-bts-master/Dockerfile
@@ -30,8 +30,6 @@
 		;; \
 	esac
 
-ADD	respawn.sh /usr/local/bin/respawn.sh
-
 WORKDIR	/tmp
 
 ARG	OSMO_BTS_BRANCH="master"
diff --git a/osmo-pcu-latest/Dockerfile b/osmo-pcu-latest/Dockerfile
index 622f933..7f1b3ac 100644
--- a/osmo-pcu-latest/Dockerfile
+++ b/osmo-pcu-latest/Dockerfile
@@ -17,8 +17,6 @@
 		;; \
 	esac
 
-ADD	respawn.sh /usr/local/bin/respawn.sh
-
 WORKDIR	/tmp
 
 VOLUME	/data
diff --git a/osmo-pcu-latest/respawn.sh b/osmo-pcu-latest/respawn.sh
deleted file mode 100755
index 2413916..0000000
--- a/osmo-pcu-latest/respawn.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-trap "kill 0" EXIT
-
-i=0
-max_i=500
-while [ $i -lt $max_i ]; do
-	echo "$i: starting: $*"
-	$* &
-	LAST_PID=$!
-	wait $LAST_PID
-	echo "$i: stopped pid $LAST_PID with status $?"
-	i=$(expr $i + 1)
-done
-echo "exiting after $max_i runs"
diff --git a/osmo-pcu-master/Dockerfile b/osmo-pcu-master/Dockerfile
index f8e6ded..41cd6d5 100644
--- a/osmo-pcu-master/Dockerfile
+++ b/osmo-pcu-master/Dockerfile
@@ -21,8 +21,6 @@
 		;; \
 	esac
 
-ADD	respawn.sh /usr/local/bin/respawn.sh
-
 WORKDIR	/tmp
 
 ARG	OSMO_PCU_BRANCH="master"
diff --git a/osmo-pcu-master/respawn.sh b/osmo-pcu-master/respawn.sh
deleted file mode 100755
index 2413916..0000000
--- a/osmo-pcu-master/respawn.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-trap "kill 0" EXIT
-
-i=0
-max_i=500
-while [ $i -lt $max_i ]; do
-	echo "$i: starting: $*"
-	$* &
-	LAST_PID=$!
-	wait $LAST_PID
-	echo "$i: stopped pid $LAST_PID with status $?"
-	i=$(expr $i + 1)
-done
-echo "exiting after $max_i runs"

-- 
To view, visit https://gerrit.osmocom.org/c/docker-playground/+/23303
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: I3ec86c8610b3b43d39ea8e3da444861d317ced4e
Gerrit-Change-Number: 23303
Gerrit-PatchSet: 4
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210311/f48b1a07/attachment.htm>


More information about the gerrit-log mailing list