feat: py 3.12 & cleanup

This commit is contained in:
nyyu 2024-01-06 22:12:55 +01:00
parent 0bfc75a6de
commit 37b152d3d2
4 changed files with 86 additions and 21 deletions

View File

@ -1,10 +1,11 @@
FROM ghcr.io/linuxserver/baseimage-alpine:3.19
FROM python:3.12.1-alpine
# set version label
ARG DOCKER_IMAGE_CREATED
ARG VERSION
LABEL build_version="pyload docker version:- ${VERSION} Build-date:- ${DOCKER_IMAGE_CREATED}"
ENV HOME="/config"
# add local files
COPY *.patch root/ /
RUN \
wget https://nexus.nyyu.dev/repository/files/alpine/7zip-23.01-r0.apk && \
@ -14,35 +15,32 @@ RUN \
apk add --no-cache --virtual=build-dependencies \
build-base \
curl-dev \
libffi-dev \
libjpeg-turbo-dev \
openssl-dev \
python3-dev \
zlib-dev && \
patch && \
echo "**** install packages ****" && \
apk add --no-cache \
tini su-exec shadow \
curl \
ffmpeg \
libjpeg-turbo \
python3 \
py3-pip \
sqlite \
tesseract-ocr && \
echo "**** install pyload ****" && \
PYLOAD='https://github.com/pyload/pyload/archive/develop.zip#[all]' && \
if [[ -n "${VERSION}" && "${VERSION}" != "dev" ]]; then \
PYLOAD="pyload-ng[all]==${VERSION}"; \
fi && \
pip3 install --break-system-packages -U "${PYLOAD}" && \
pip3 install --no-cache-dir --break-system-packages -U "${PYLOAD}" && \
pip uninstall -y Js2Py && \
cd /usr/local/lib/python3.12/site-packages/ && patch -Np1 < /py3-12.patch && cd / \
echo "**** cleanup ****" && \
apk del --purge \
build-dependencies && \
rm -rf \
/tmp/*
# add local files
COPY root/ /
/tmp/* \
/*.patch && \
echo "**** add user abc ****" && \
adduser -D -u 911 -h /config abc
# ports and volumes
EXPOSE 8000
VOLUME /config
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/start.sh"]

57
py3-12.patch Normal file
View File

@ -0,0 +1,57 @@
diff --git a/pyload/core/utils/check.py b/pyload/core/utils/check.py
index 3c98fd490..4f135cf0b 100644
--- a/pyload/core/utils/check.py
+++ b/pyload/core/utils/check.py
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
-import imp
from collections.abc import Iterable, Mapping, Sequence
@@ -54,17 +53,6 @@ def is_mapping(obj):
return isinstance(obj, Mapping)
-def is_module(name, path=None):
- """Check if exists a module with given name."""
- try:
- fp, _, _ = imp.find_module(name, path)
- if fp is not None:
- fp.close()
- return True
- except ImportError:
- return False
-
-
def missing(iterable, start=None, end=None):
"""List all the values between 'start' and 'stop' that are missing from 'iterable'."""
iter_seq = set(map(int, iterable))
diff --git a/pyload/core/utils/misc.py b/pyload/core/utils/misc.py
index 6d2f23cc5..96d931108 100644
--- a/pyload/core/utils/misc.py
+++ b/pyload/core/utils/misc.py
@@ -3,11 +3,6 @@
import random
import string
-import js2py
-
-js2py.disable_pyimport()
-
-
def random_string(length):
seq = string.ascii_letters + string.digits + string.punctuation
return "".join(random.choice(seq) for _ in range(length))
@@ -23,8 +18,7 @@ def is_plural(value):
def eval_js(script, es6=False):
# return requests_html.HTML().render(script=script, reload=False)
- return (js2py.eval_js6 if es6 else js2py.eval_js)(script)
-
+ return None
def accumulate(iterable, to_map=None):
"""
--

View File

@ -1,4 +0,0 @@
#!/usr/bin/with-contenv bash
exec \
s6-setuidgid abc pyload --userdir /config --storagedir /downloads

14
root/start.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
set -e
PUID=${PUID:-911}
PGID=${PGID:-911}
groupmod -o -g "$PGID" abc 2>/dev/null
usermod -o -u "$PUID" abc 2>/dev/null
for f in /etc/cont-init.d/*; do
sh "$f"
done
exec su-exec abc pyload --userdir /config --storagedir /downloads