Skip to content

Commit

Permalink
make commands, logs improvements, tengine update
Browse files Browse the repository at this point in the history
  • Loading branch information
lavadk committed Apr 13, 2021
1 parent a16a490 commit 964e55f
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 1 deletion.
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM python:3.9.2-buster

COPY requirements.txt /tmp/requirements.txt
RUN pip install -r /tmp/requirements.txt && rm /tmp/requirements.txt

COPY --chown=$UID liker /app/liker
COPY --chown=$UID tengine /app/tengine

WORKDIR /app
ENV PYTHONPATH=/app

CMD ["python", "liker/run.py"]

44 changes: 44 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
CURRENT_DIR := $(notdir $(patsubst %/,%,$(dir $(MKFILE_PATH))))

DOCKER_IMAGE := ${CURRENT_DIR}
DOCKER_CONTAINER := ${CURRENT_DIR}

ADDITIONAL_OPTIONS := ""
DOCKER_RUN_CMD = \
if [ $$(docker ps -q -f name=${DOCKER_CONTAINER}) ]; then \
docker kill --signal SIGINT ${DOCKER_CONTAINER}; \
fi; \
if [ $$(docker ps --all -q -f name=${DOCKER_CONTAINER}) ]; then \
docker rm -f ${DOCKER_CONTAINER}; \
fi; \
docker run \
--init \
--name ${DOCKER_CONTAINER} \
-v ${PWD}/data:/app/data \
--user $$(id -u):$$(id -g) \
$${ADDITIONAL_OPTIONS} \
${DOCKER_IMAGE}



.PHONY: list
vars:
echo Docker image: ${DOCKER_IMAGE}

build:
docker build . -t ${DOCKER_IMAGE}

run-it:
export ADDITIONAL_OPTIONS="-it --rm"; \
${DOCKER_RUN_CMD}

run-daemon:
export ADDITIONAL_OPTIONS="-d --restart=always"; \
${DOCKER_RUN_CMD}

stop:
if [ $$(docker ps -q -f name=${DOCKER_CONTAINER}) ]; then \
docker kill --signal SIGINT ${DOCKER_CONTAINER}; \
fi

4 changes: 4 additions & 0 deletions liker/setup/logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ def setup_logs():
'level': 'DEBUG',
'propagate': True,
},
# Mute mtprotosender logs
'telethon': {
'propagate': False,
},
},
}

Expand Down
2 changes: 1 addition & 1 deletion tengine

0 comments on commit 964e55f

Please sign in to comment.