Update dockerfile

This commit is contained in:
Jon 2021-12-15 18:34:26 -05:00
parent 687f0b4119
commit 50fb4559bb
No known key found for this signature in database
GPG key ID: 9665BA6CF5DC2671
3 changed files with 22 additions and 19 deletions

View file

@ -1,15 +1,11 @@
FROM python:3.9-slim
RUN echo "**** install system packages ****" \
&& apt-get update \
&& apt-get upgrade -y --no-install-recommends \
&& apt-get install -y tzdata --no-install-recommends \
&& apt-get install -y gcc g++ libxml2-dev libxslt-dev libz-dev
COPY requirements.txt /
FROM hotio/base:alpine
RUN apk add --no-cache py3-pip
COPY --chown=hotio:users requirements.txt /
RUN echo "**** install python packages ****" \
&& pip3 install --no-cache-dir --upgrade --requirement /requirements.txt \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /requirements.txt /tmp/* /var/tmp/* /var/lib/apt/lists/*
COPY . /
VOLUME /config
ENTRYPOINT ["python3","qbit_manage.py"]
&& pip3 install --user --no-cache-dir --upgrade --requirement /requirements.txt \
&& rm -rf /requirements.txt /tmp/* /var/tmp/*
COPY --chown=hotio:users . "${APP_DIR}"
WORKDIR ${APP_DIR}
ENTRYPOINT ["python3", "qbit_manage.py"]

View file

@ -57,7 +57,7 @@ class Config:
self.nohardlinks[cat]['max_seeding_time'] = self.util.check_for_attribute(self.data, "max_seeding_time", parent="nohardlinks", subparent=cat, var_type="int", default_int=-2, default_is_none=True,do_print=False)
self.nohardlinks[cat]['limit_upload_speed'] = self.util.check_for_attribute(self.data, "limit_upload_speed", parent="nohardlinks", subparent=cat, var_type="int", default_int=-1, default_is_none=True,do_print=False)
else:
raise Failed(f"Config Error: Category {cat} is defined under nohardlinks attribute but is not defined in the cat attriute.")
raise Failed(f"Config Error: Category {cat} is defined under nohardlinks attribute but is not defined in the cat attribute.")
else:
if self.args["tag_nohardlinks"]:
raise Failed("Config Error: nohardlinks attribute not found")

View file

@ -72,7 +72,12 @@ divider = get_arg("QBT_DIVIDER", args.divider)
screen_width = get_arg("QBT_WIDTH", args.width, arg_int=True)
stats = {}
args = {}
default_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "config")
if os.path.isdir('/config'):
default_dir = '/config'
else:
default_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "config")
for v in ['run','sch','config_file','log_file','cross_seed','recheck','cat_update','tag_update','rem_unregistered','rem_orphaned','tag_nohardlinks','skip_recycle','dry_run','log_level','divider','screen_width']:
args[v] = eval(v)
@ -118,14 +123,14 @@ with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "VERSION")) a
version = line
break
file_logger = os.path.join(default_dir, "logs", log_file)
log_path = os.path.join(default_dir, "logs")
file_logger = os.path.join(log_path, log_file)
max_bytes = 1024 * 1024 * 2
file_handler = RotatingFileHandler(file_logger, delay=True, mode="w", maxBytes=max_bytes, backupCount=10, encoding="utf-8")
util.apply_formatter(file_handler)
file_handler.addFilter(fmt_filter)
logger.addHandler(file_handler)
os.chmod(log_path, 0o777)
def start():
start_time = datetime.now()
@ -219,6 +224,7 @@ def start():
def end():
logger.info("Exiting Qbit_manage")
os.chmod(file_logger, 0o777)
logger.removeHandler(file_handler)
sys.exit(0)
@ -254,6 +260,7 @@ if __name__ == '__main__':
logger.debug(f" --width (QBT_WIDTH): {screen_width}")
logger.debug("")
os.chmod(file_logger, 0o777)
try:
if run:
logger.info(f" Run Mode: Script will exit after completion.")