diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1c7432c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,59 @@ +FROM alpine:edge + +RUN apk add --no-cache git +RUN apk add --no-cache musl-dev +RUN apk add --no-cache gcc +RUN apk add --no-cache sqlite +RUN apk add --no-cache go +RUN apk add --no-cache perl +RUN apk add --no-cache make + +VOLUME /app/var +VOLUME /app/src +EXPOSE 1337 + +ARG gomaxprocs="8" + +WORKDIR /app + +ENV SRC_DIR=/app/src/catbase/ +RUN mkdir -p $SRC_DIR + +ENV TWITCHAUTHORIZATION="OAuth " +ENV TWITCHCLIENTID="" +ENV UNTAPPDTOKEN="" +ENV HTTPADDR="0.0.0.0:1337" + +ENV TWITTERACCESSTOKEN="" +ENV TWITTERACCESSSECRET="" +ENV TWITTERCONSUMERKEY="" +ENV TWITTERCONSUMERSECRET="" + +ENV AOCSESSION="" + +ENV TWILIOTOKEN="" +ENV TWILIOSID="" +ENV TWILIONUMBER="+5558675309" + +ENV TYPE=slackapp +ENV SLACKTOKEN=FOO +ENV SLACKUSERTOKEN=FOO +ENV SLACKVERIFICATION=FOO +ENV SLACKBOTID=FOO + +ENV SLACKAPPLOGDIR=/app/var/logs +ENV SLACKAPPLOGMESSAGEDIR=/app/var/logs + +ENV GOMAXPROCS=8 + +ADD . $SRC_DIR + +RUN apk add --no-cache tzdata +ENV TZ America/New_York + +RUN git clone https://github.com/chrissexton/rank-amateur-cowsay.git cowsay && cd cowsay && ./install.sh +RUN cd $SRC_DIR; go get ./...; go build -o /app/catbase + +RUN git clone https://gitlab.com/DavidGriffith/frotz.git frotz && cd frotz && make dfrotz && cp dfrotz /app + +ENTRYPOINT ["/app/catbase", "-db=/app/var/catbase.db", "-debug"] diff --git a/docker/build.sh b/docker/build.sh new file mode 100755 index 0000000..a10a2db --- /dev/null +++ b/docker/build.sh @@ -0,0 +1,10 @@ +#!/bin/bash -e + +set -e +set -o pipefail + +# To be run from the catbase src directory +[[ ! -f main.go ]] && echo "You must run this from the catbase src root." && exit 1 + +docker build -t velour/catbase -t chrissexton/private:catbase . +docker push chrissexton/private:catbase diff --git a/docker/rebuild.sh b/docker/rebuild.sh new file mode 100755 index 0000000..ab9157a --- /dev/null +++ b/docker/rebuild.sh @@ -0,0 +1,42 @@ +#!/bin/bash -e + +set -e +set -o pipefail + +CONTAINER=catbase + +OLD_ID=$(docker ps -f NAME="$CONTAINER" -q) + +if [[ $OLD_ID -gt 0 ]]; then + echo "Removing old container $OLD_ID" + docker stop $CONTAINER + docker rm -f $CONTAINER +fi +docker run \ + -d \ + -p 127.0.0.1:1337:1337 \ + -v var:/app/var \ + -v src:/app/src \ + -e TWITCHAUTHORIZATION="OAuth " \ + -e TWITCHCLIENTID="" \ + -e UNTAPPDTOKEN="" \ + -e HTTPADDR="0.0.0.0:1337" \ + -e TWITTERACCESSTOKEN="" \ + -e TWITTERACCESSSECRET="" \ + -e TWITTERCONSUMERKEY="" \ + -e TWITTERCONSUMERSECRET="" \ + -e AOCSESSION="" \ + -e TWILIOTOKEN="" \ + -e TWILIOSID="" \ + -e TWILIONUMBER="+1" \ + -e TYPE=slackapp \ + -e SLACKTOKEN= \ + -e SLACKUSERTOKEN= \ + -e SLACKVERIFICATION= \ + -e SLACKBOTID= \ + -e SLACKAPPLOGDIR=/app/var/logs \ + -e SLACKAPPLOGMESSAGEDIR=/app/var/logs \ + -e GOMAXPROCS=8 \ + --name $CONTAINER chrissexton/private:catbase + +echo 'Subject: catbase built' | ssmtp noreply@velour.ninja