Browse Source

Add docker build to bot

master
Matthew Faltys 7 years ago
parent
commit
4a5fc54781
  1. 2
      .gitignore
  2. 32
      Makefile
  3. 2
      config.gcfg
  4. 8
      deps/Dockerfile
  5. BIN
      deps/rootfs.tar.gz
  6. 10
      deps/run.sh

2
.gitignore vendored

@ -1 +1,3 @@
*.swp
bin/
stage.tmp/

32
Makefile

@ -0,0 +1,32 @@
GOC=go build
GOFLAGS=-a -ldflags '-s'
CGOR=CGO_ENABLED=0
IMAGE_NAME=smpldbot
all: lorebot
lorebot:
$(GOC) lorebot/lorebot.go
run:
go run lorebot/lorebot.go
stat:
mkdir -p bin/
$(CGOR) $(GOC) -o bin/lorebot $(GOFLAGS) lorebot/*.go
docker: stat
mkdir stage.tmp/
cp bin/lorebot stage.tmp/
cp deps/rootfs.tar.gz stage.tmp/
cp deps/Dockerfile stage.tmp/
chmod +x deps/run.sh
cp deps/run.sh stage.tmp/
cp config.gcfg stage.tmp/
cd stage.tmp/ && \
sudo docker build -t $(IMAGE_NAME) .
@echo "$(IMAGE_NAME) built"
clean:
rm -rf bin/
rm -rf stage.tmp/

2
config.gcfg

@ -4,5 +4,5 @@
APIToken = "xoxb-189788161987-7FK5NKnBtrFGGtv4yszr2URb"
[redis]
host = "localhost:6379"
host = "127.0.0.1:6379"
password = ""

8
deps/Dockerfile vendored

@ -0,0 +1,8 @@
FROM scratch
ADD rootfs.tar.gz /
COPY config.gcfg /
COPY lorebot /
COPY run.sh /
CMD ["/run.sh"]

BIN
deps/rootfs.tar.gz vendored

Binary file not shown.

10
deps/run.sh vendored

@ -0,0 +1,10 @@
#!/bin/sh
#echo "daemonize yes" > /redis.conf
echo "dbfilename dump.rdb" >> /redis.conf
echo "dir /redisbackup/" >> /redis.conf
echo "save 30 1" >> /redis.conf
redis-server /redis.conf &
/lorebot $@
Loading…
Cancel
Save