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
changes/03/23303/4
Vadim Yanitskiy 2 years ago
parent 44fbe564bb
commit 085656ac45
  1. 1
      .gitignore
  2. 3
      centos8-build/Dockerfile
  3. 3
      centos8-obs-latest/Dockerfile
  4. 0
      common/respawn.sh
  5. 3
      debian-buster-build/Dockerfile
  6. 3
      debian-jessie-build/Dockerfile
  7. 3
      debian-sid-build/Dockerfile
  8. 3
      debian-stretch-obs-latest/Dockerfile
  9. 3
      make/Makefile
  10. 2
      osmo-bts-latest/Dockerfile
  11. 15
      osmo-bts-latest/respawn.sh
  12. 2
      osmo-bts-master/Dockerfile
  13. 2
      osmo-pcu-latest/Dockerfile
  14. 15
      osmo-pcu-latest/respawn.sh
  15. 2
      osmo-pcu-master/Dockerfile
  16. 15
      osmo-pcu-master/respawn.sh

1
.gitignore vendored

@ -1,3 +1,4 @@
.release
.common
/_cache

@ -50,5 +50,8 @@ RUN dnf install -y \
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

@ -17,5 +17,8 @@ RUN dnf install -y dnf-utils wget && \
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

@ -52,3 +52,6 @@ RUN apt-get update && \
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

@ -52,3 +52,6 @@ RUN apt-get update && \
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

@ -50,3 +50,6 @@ RUN apt-get update && \
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

@ -18,5 +18,8 @@ RUN apt-key add /tmp/Release.key && \
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

@ -55,9 +55,12 @@ SHELL=/bin/bash
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:

@ -20,8 +20,6 @@ RUN case "$DISTRO" in \
;; \
esac
ADD respawn.sh /usr/local/bin/respawn.sh
WORKDIR /tmp
VOLUME /data

@ -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"

@ -30,8 +30,6 @@ RUN case "$DISTRO" in \
;; \
esac
ADD respawn.sh /usr/local/bin/respawn.sh
WORKDIR /tmp
ARG OSMO_BTS_BRANCH="master"

@ -17,8 +17,6 @@ RUN case "$DISTRO" in \
;; \
esac
ADD respawn.sh /usr/local/bin/respawn.sh
WORKDIR /tmp
VOLUME /data

@ -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"

@ -21,8 +21,6 @@ RUN case "$DISTRO" in \
;; \
esac
ADD respawn.sh /usr/local/bin/respawn.sh
WORKDIR /tmp
ARG OSMO_PCU_BRANCH="master"

@ -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"
Loading…
Cancel
Save