Created
October 24, 2017 16:52
-
-
Save gorbiz/8b9130238c35a350b7f1e40584e33aef to your computer and use it in GitHub Desktop.
CILAMP docker example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# example usage: | |
# docker build -t lamp . | |
# docker run -e LAMPID=mylampID -e TEST_CMD='date +%S | grep 1' -e TEST_INTERVAL=60 lamp | |
FROM alpine | |
RUN set -ex; \ | |
apk update; \ | |
apk add bash; \ | |
apk add curl | |
CMD while :; do ( \ | |
eval $TEST_CMD &> /dev/null \ | |
&& (echo TRUE && curl -s -X POST -F "color=${TRUE_COLOR:-#00ff00}" https://api.cilamp.se/v1/$LAMPID/ > /dev/null) \ | |
|| (echo FALSE && curl -s -X POST -F "color=${FALSE_COLOR:-#ff0000}" https://api.cilamp.se/v1/$LAMPID/ > /dev/null) \ | |
); \ | |
sleep $TEST_INTERVAL; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment