diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..723ef36
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+.idea
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..6c7a852
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,9 @@
+FROM alpine:latest
+RUN apk add --update \
+ bash \
+ curl \
+ && rm /var/cache/apk/*
+COPY slack.sh /slack.sh
+RUN chmod +x /slack.sh \
+ && touch /tmp/ip.txt \
+ && mkdir -p /tmp
diff --git a/README.md b/README.md
index c785d95..f290fb8 100644
--- a/README.md
+++ b/README.md
@@ -45,15 +45,6 @@ Hacky Slack requires cURL (https://curl.haxx.se). Most systems have it installed
Installation is pretty simple. Just copy the slack.sh
to /usr/local/bin
. Then chmod +x /usr/local/bin/slack.sh
.
-Please note that the default config (slack.sh) assumes you are installing slack into /usr/local/bin
:
-
-```
-APP="/usr/local/bin/slack.sh"
-BIN="/usr/bin/slack"
-```
-
-BIN is used to ln
to APP to BIN. This will allow you to use slack
vs /usr/local/bin/slack.sh
-
If you decide to copy Hacky Slack to a different APP directory change the settings accordingly.
# Using Hacky Slack
@@ -90,13 +81,17 @@ For more information on the above parameters, please check out the Slack docs:
The channel is "general" with username "hacky-slack". The icon is "apple" and the author is "apple". The author name is linked to "apple.com" and the text sent in the message is "Where are the new 2016 Macbook models?"
```
-slack -c "#general" -u "hacky-slack" -i "apple" -a "Macbook" -b "http://www.apple.com/ -t "Where are the new 2016 Macbook models?"
+sh slack.sh -c "#general" -u "hacky-slack" -i "apple" -a "Macbook" -b "http://www.apple.com/ -t "Where are the new 2016 Macbook models?"
```
Here is a sample message and a screenshot of the message with various flags set.
```
-slack -a -t "Hello World" -i ":slack:" -T "Titles are awesome" -p "Pretext is so helpful to include" -s "info"
+sh slack.sh -a -t "Hello World" -i ":slack:" -T "Titles are awesome" -p "Pretext is so helpful to include" -s "info"
+```
+
+```
+sh slack.sh -c "#general" -u "steve" -i "dog" -a "Macbook Pro" -B "http://www.apple.com/" -p "Almost" -Z "Where are the new 2016 Macbook models" -s "ok" -T "Wow" -L "https://www.apple.com" -k "213912391-2093-10293ASSJASLKA"
```
Here is the command represented in Slack:
@@ -106,6 +101,16 @@ Here is the command represented in Slack:
Note: These examples assume you have set your token and webhook endpoint.
+# Hack Slack Docker style
+
+There is a `Dockerfile` included which may simplify running the Hacky Slack. This assumes you have Docker installed. Simply build your image by running `docker build -t slack .`
+
+Here is an example of running with Docker:
+```
+docker run -it slack /bin/bash /slack.sh -c "#general" -u "steve" -i "dog" -a "Macbook Pro" -B "http://www.apple.com/" -p "Almost" -Z "Where are the new 2016 Macbook models" -s "ok" -T "Wow" -L "https://www.apple.com" -k "213912391-2093-10293ASSJASLKA"
+```
+
+This is approach consumes a lot more space that the file alone. The total image is < 10MB. However, it might provide more flexibility in some use cases. Your mileage may vary.
# Hacky Slack + Monit
diff --git a/etc/slack.d/monit b/etc/slack.d/monit
index d7f009f..b46b20d 100644
--- a/etc/slack.d/monit
+++ b/etc/slack.d/monit
@@ -4,10 +4,11 @@
PRETEXT="${MONIT_DATE} | ${MONIT_HOST}: ${MONIT_EVENT}"
FALLBACK="${MONIT_DATE} | ${MONIT_HOST}: ${MONIT_EVENT}"
- if test "${PRIORITY}" = "OK"; then echo "INFO: STATUS (-s) is OK. Setting a default STATUS to OK..." && ICON=${ICON:-':monit-ok:'} && COLOR=${COLOR:-'#36a64f'}; fi
- if test "${PRIORITY}" = "INFO"; then echo "INFO: STATUS (-s) is INFO. Setting a default STATUS to INFO..." && ICON=${ICON:-':monit-info:'} && COLOR=${COLOR:-'#439FE0'}; fi
- if test "${PRIORITY}" = "WARN"; then echo "INFO: STATUS (-s) is WARN. Setting a default STATUS to WARN..." && ICON=${ICON:-':monit-warn:'} && COLOR=${COLOR:-'#ed7d21'}; fi
- if test "${PRIORITY}" = "ERROR"; then echo "INFO: STATUS (-s) is ERROR. Setting a default STATUS to ERROR..." && ICON=${ICON:-':monit-error:'} && COLOR=${COLOR:-'#E21B6C'}; fi
+ if test "${PRIORITY}" = "OK"; then echo "INFO: STATUS (-s) is OK. Setting a default STATUS to OK..." && ICON=${ICON:-'monit-ok'} && COLOR=${COLOR:-'#36a64f'}; fi
+ if test "${PRIORITY}" = "INFO"; then echo "INFO: STATUS (-s) is INFO. Setting a default STATUS to INFO..." && ICON=${ICON:-'monit-info'} && COLOR=${COLOR:-'#439FE0'}; fi
+ if test "${PRIORITY}" = "WARN"; then echo "INFO: STATUS (-s) is WARN. Setting a default STATUS to WARN..." && ICON=${ICON:-'monit-warn'} && COLOR=${COLOR:-'#ed7d21'}; fi
+ if test "${PRIORITY}" = "ERROR"; then echo "INFO: STATUS (-s) is ERROR. Setting a default STATUS to ERROR..." && ICON=${ICON:-'monit-error'} && COLOR=${COLOR:-'#E21B6C'}; fi
+
# Save for later
# if grep -Fq 'Action done' ${MONIT_DESCRIPTION}; then ICON=${ICON-':cpu:'}; fi
diff --git a/slack.sh b/slack.sh
old mode 100644
new mode 100755