From 2aae7dd59fee37c2e1560d36ff184bdaa3a26c4c Mon Sep 17 00:00:00 2001 From: David Boreham Date: Sun, 30 Oct 2022 20:41:05 -0600 Subject: [PATCH] Simple container for testing stack orchestrator --- compose/docker-compose-test.yml | 5 +++++ container-build/cerc-test-container/Dockerfile | 5 +++++ container-build/cerc-test-container/build.sh | 4 ++++ container-build/cerc-test-container/run.sh | 16 ++++++++++++++++ container-image-list.txt | 3 ++- pod-list.txt | 1 + 6 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 compose/docker-compose-test.yml create mode 100644 container-build/cerc-test-container/Dockerfile create mode 100755 container-build/cerc-test-container/build.sh create mode 100755 container-build/cerc-test-container/run.sh diff --git a/compose/docker-compose-test.yml b/compose/docker-compose-test.yml new file mode 100644 index 00000000..058b2b3b --- /dev/null +++ b/compose/docker-compose-test.yml @@ -0,0 +1,5 @@ +version: "3.2" +services: + test: + image: cerc/test-container:local + restart: always diff --git a/container-build/cerc-test-container/Dockerfile b/container-build/cerc-test-container/Dockerfile new file mode 100644 index 00000000..29b42a84 --- /dev/null +++ b/container-build/cerc-test-container/Dockerfile @@ -0,0 +1,5 @@ +FROM alpine:latest + +COPY run.sh /app/run.sh + +ENTRYPOINT ["/app/run.sh"] diff --git a/container-build/cerc-test-container/build.sh b/container-build/cerc-test-container/build.sh new file mode 100755 index 00000000..1595645c --- /dev/null +++ b/container-build/cerc-test-container/build.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +# Build cerc/test-container +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +docker build -t cerc/test-container:local -f ${SCRIPT_DIR}/Dockerfile $SCRIPT_DIR \ No newline at end of file diff --git a/container-build/cerc-test-container/run.sh b/container-build/cerc-test-container/run.sh new file mode 100755 index 00000000..5f59acab --- /dev/null +++ b/container-build/cerc-test-container/run.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +# Test if the container's filesystem is old (run previously) or new +EXISTSFILENAME=/var/exists +echo "Test container starting" +if [[ -f "$EXISTSFILENAME" ]]; +then + TIMESTAMP = `cat $EXISTSFILENAME` + echo "Filesystem is old, created: $TIMESTAMP" +else + echo "Filesystem is fresh" + echo `date` > $EXISTSFILENAME +fi + +# Sleep forever to keep docker happy +while true; do sleep 10; done \ No newline at end of file diff --git a/container-image-list.txt b/container-image-list.txt index fd2fe645..80cef725 100644 --- a/container-image-list.txt +++ b/container-image-list.txt @@ -11,4 +11,5 @@ cerc/ipld-eth-server cerc/laconicd cerc/laconic-cns-cli cerc/fixturenet-eth-geth -cerc/fixturenet-eth-lighthouse \ No newline at end of file +cerc/fixturenet-eth-lighthouse +cerc/test-container diff --git a/pod-list.txt b/pod-list.txt index 09a7baa5..d07d3d08 100644 --- a/pod-list.txt +++ b/pod-list.txt @@ -9,3 +9,4 @@ lighthouse prometheus-grafana laconicd fixturenet-eth +test