You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.4 KiB
60 lines
1.4 KiB
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 \ |
|
lorebot/botfunc.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" |
|
|
|
aci: stat |
|
mkdir -p stage.tmp/lorebot-layout/rootfs/ |
|
tar -zxf deps/rootfs.tar.gz -C stage.tmp/lorebot-layout/rootfs/ |
|
cp bin/lorebot stage.tmp/lorebot-layout/rootfs/lorebot |
|
chmod +x deps/run.sh |
|
cp deps/run.sh stage.tmp/lorebot-layout/rootfs/ |
|
cp deps/redis.conf stage.tmp/lorebot-layout/rootfs/ |
|
cp config.gcfg stage.tmp/lorebot-layout/rootfs/ |
|
cp deps/manifest.json stage.tmp/lorebot-layout/manifest |
|
cd stage.tmp/ && \ |
|
actool build lorebot-layout lorebot.aci && \ |
|
mv lorebot.aci ../ |
|
@echo "lorebot.aci built" |
|
|
|
test_aci: |
|
mkdir -p /tmp/lorebot/redis/ |
|
touch /tmp/lorebot/dump.rdb |
|
cp .auth /tmp/lorebot/ |
|
sudo rkt run \ |
|
--volume redis,kind=host,source=/tmp/lorebot/redis/ \ |
|
--volume auth,kind=host,source=/tmp/lorebot/.auth \ |
|
--net=host \ |
|
--insecure-options=image \ |
|
./lorebot.aci |
|
|
|
clean: |
|
rm -rf bin/ |
|
rm -rf stage.tmp/ |
|
rm -rf lorebot.aci
|
|
|