mirror of
https://github.com/Viren070/MediaFusion.git
synced 2025-12-01 23:21:11 +01:00
chore: migrate from pipenv to uv and update Dockerfile & update to Python 3.13
This commit is contained in:
@@ -46,3 +46,12 @@ mediafusion.local*
|
||||
kodi/
|
||||
!kodi/*.py
|
||||
!deployment/startup.sh
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
@@ -56,6 +56,8 @@ endif
|
||||
@sed -i 's|image: $(DOCKER_REPO)/$(IMAGE_NAME):[0-9.]*|image: $(DOCKER_REPO)/$(IMAGE_NAME):$(VERSION_NEW)|g' deployment/docker-compose/docker-compose-minimal.yml
|
||||
# Update k8s deployment
|
||||
@sed -i 's|image: $(DOCKER_REPO)/$(IMAGE_NAME):[0-9.]*|image: $(DOCKER_REPO)/$(IMAGE_NAME):$(VERSION_NEW)|g' deployment/k8s/local-deployment.yaml
|
||||
# Update pyproject.toml
|
||||
@sed -i -e "s/version = \"[0-9.]*\"/version = \"$(VERSION_NEW)\"/" pyproject.toml
|
||||
@echo "Version updated to $(VERSION_NEW) in all files"
|
||||
|
||||
build-multi:
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
[[source]]
|
||||
url = "https://pypi.org/simple"
|
||||
verify_ssl = true
|
||||
name = "pypi"
|
||||
|
||||
[packages]
|
||||
fastapi = "*"
|
||||
uvicorn = { extras = ["standard"] }
|
||||
pydantic = "*"
|
||||
requests = "*"
|
||||
beautifulsoup4 = "*"
|
||||
beanie = "*"
|
||||
motor = "*"
|
||||
pymongo = "*"
|
||||
dnspython = "*"
|
||||
jinja2 = "*"
|
||||
apscheduler = "*"
|
||||
python-dateutil = "*"
|
||||
bencodepy = "*"
|
||||
pydantic-settings = "*"
|
||||
pycryptodome = "*"
|
||||
pillow = "*"
|
||||
httpx = "*"
|
||||
uvloop = { markers = "sys_platform != 'win32'" }
|
||||
thefuzz = "*"
|
||||
pikpakapi = {git = "git+https://github.com/mhdzumair/PikPakAPI.git"}
|
||||
diskcache = "*"
|
||||
demagnetize = "*"
|
||||
redis = {extras = ["hiredis"] }
|
||||
dramatiq = {extras = ["redis", "watch"] }
|
||||
gunicorn = "*"
|
||||
scrapy = "*"
|
||||
aioqbt = {git = "git+https://github.com/mhdzumair/aioqbt.git"}
|
||||
aiowebdav = "*"
|
||||
m3u-ipytv = "*"
|
||||
python-multipart = "*"
|
||||
prometheus-client = "*"
|
||||
pyasynctracker = "*"
|
||||
humanize = {git = "git+https://github.com/python-humanize/humanize.git"}
|
||||
scrapy-playwright = "*"
|
||||
cinemagoerng = {git = "git+https://github.com/mhdzumair/cinemagoerng.git"}
|
||||
tqdm = "*"
|
||||
parsett = "*"
|
||||
tenacity = "*"
|
||||
ratelimit = "*"
|
||||
qrcode = "*"
|
||||
aioseedrcc = "*"
|
||||
pytz = "*"
|
||||
aiohttp-socks = "*"
|
||||
socksio = "*"
|
||||
dramatiq-abort = "*"
|
||||
tzdata = "*"
|
||||
ipython = "*"
|
||||
|
||||
[dev-packages]
|
||||
pysocks = "*"
|
||||
requests-cache = "*"
|
||||
kodistubs = "*"
|
||||
|
||||
[requires]
|
||||
python_version = "3.12"
|
||||
Generated
-3375
File diff suppressed because it is too large
Load Diff
+17
-16
@@ -1,10 +1,10 @@
|
||||
FROM python:3.12-slim-bookworm AS builder
|
||||
FROM python:3.13-slim-bookworm AS builder
|
||||
|
||||
WORKDIR /mediafusion
|
||||
|
||||
# Install build dependencies
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends git curl && \
|
||||
apt-get install -y --no-install-recommends git curl build-essential && \
|
||||
pip install --upgrade pip && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
@@ -18,37 +18,38 @@ USER mediafusion
|
||||
|
||||
# Set the PATH environment variable to include the local bin directory
|
||||
ENV PATH="/home/mediafusion/.local/bin:$PATH"
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
# Install pipenv and Python dependencies
|
||||
COPY --chown=mediafusion:mediafusion Pipfile Pipfile.lock ./
|
||||
RUN pip install --user pipenv && \
|
||||
pipenv install --deploy --ignore-pipfile
|
||||
# Install uv and Python dependencies
|
||||
COPY --from=ghcr.io/astral-sh/uv:0.6.3 /uv /uvx /bin/
|
||||
RUN --mount=type=cache,target=/mediafusion/.cache/uv \
|
||||
--mount=type=bind,source=uv.lock,target=uv.lock \
|
||||
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
|
||||
uv sync --frozen --no-install-project --compile-bytecode
|
||||
|
||||
FROM python:3.12-slim-bookworm
|
||||
FROM python:3.13-slim-bookworm AS runtime
|
||||
|
||||
ARG VERSION
|
||||
|
||||
WORKDIR /mediafusion
|
||||
|
||||
|
||||
# Install runtime dependencies
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends curl && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Create the mediafusion user with a specified home directory
|
||||
RUN groupadd -r mediafusion && \
|
||||
useradd --no-log-init -r -g mediafusion -m -d /home/mediafusion mediafusion
|
||||
|
||||
# Copy the Python environment and other necessary files from the builder stage
|
||||
COPY --from=builder /home/mediafusion/.local /home/mediafusion/.local
|
||||
COPY --from=builder /etc/group /etc/passwd /etc/
|
||||
|
||||
ENV PATH="/home/mediafusion/.local/bin:$PATH"
|
||||
COPY --from=builder --chown=mediafusion:mediafusion /mediafusion/.venv /mediafusion/.venv
|
||||
|
||||
ENV PATH="/mediafusion/.venv/bin:$PATH"
|
||||
ENV VERSION=${VERSION}
|
||||
|
||||
COPY . .
|
||||
|
||||
# set folder permissions
|
||||
RUN chown -R mediafusion:mediafusion /mediafusion
|
||||
COPY --chown=mediafusion:mediafusion . /mediafusion
|
||||
|
||||
USER mediafusion
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Running Beanie migrations..."
|
||||
pipenv run beanie migrate -uri "${MONGO_URI:-$mongo_uri}" -db mediafusion -p migrations/
|
||||
beanie migrate -uri "${MONGO_URI:-$mongo_uri}" -db mediafusion -p migrations/
|
||||
|
||||
echo "Starting FastAPI server..."
|
||||
pipenv run gunicorn api.main:app -w 4 -k uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000 --timeout 120 --max-requests 500 --max-requests-jitter 200
|
||||
gunicorn api.main:app -w 4 -k uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000 --timeout 120 --max-requests 500 --max-requests-jitter 200
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
[project]
|
||||
name = "mediafusion"
|
||||
version = "4.3.23"
|
||||
description = "Media Fusion Add-On For Stremio & Kodi - A powerful streaming API with support for multiple providers and advanced scraping capabilities"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.12"
|
||||
license = "MIT"
|
||||
authors = [
|
||||
{ name = "Mohamed Zumair", email = "mhdzumair@gmail.com" },
|
||||
{ name = "ragmehos" }
|
||||
]
|
||||
|
||||
dependencies = [
|
||||
"fastapi",
|
||||
"uvicorn[standard]",
|
||||
"pydantic",
|
||||
"requests",
|
||||
"beautifulsoup4",
|
||||
"beanie",
|
||||
"motor",
|
||||
"pymongo",
|
||||
"dnspython",
|
||||
"jinja2",
|
||||
"apscheduler",
|
||||
"python-dateutil",
|
||||
"bencodepy",
|
||||
"pydantic-settings",
|
||||
"pycryptodome",
|
||||
"pillow",
|
||||
"httpx",
|
||||
"uvloop; sys_platform != \"win32\"",
|
||||
"thefuzz",
|
||||
"pikpakapi",
|
||||
"diskcache",
|
||||
"demagnetize",
|
||||
"redis[hiredis]",
|
||||
"dramatiq[redis,watch]",
|
||||
"gunicorn",
|
||||
"scrapy",
|
||||
"aioqbt",
|
||||
"aiowebdav",
|
||||
"m3u-ipytv",
|
||||
"python-multipart",
|
||||
"prometheus-client",
|
||||
"pyasynctracker",
|
||||
"scrapy-playwright",
|
||||
"cinemagoerng",
|
||||
"tqdm",
|
||||
"parsett",
|
||||
"tenacity",
|
||||
"ratelimit",
|
||||
"qrcode",
|
||||
"aioseedrcc",
|
||||
"pytz",
|
||||
"aiohttp-socks",
|
||||
"socksio",
|
||||
"dramatiq-abort",
|
||||
"tzdata",
|
||||
"ipython",
|
||||
"scrapy-fake-useragent>=1.4.4",
|
||||
"humanize>=4.12.1",
|
||||
]
|
||||
|
||||
[dependency-groups]
|
||||
dev = [
|
||||
"pysocks",
|
||||
"requests-cache",
|
||||
"kodistubs",
|
||||
]
|
||||
|
||||
[tool.uv.sources]
|
||||
pikpakapi = {git = "git+https://github.com/mhdzumair/PikPakAPI.git"}
|
||||
aioqbt = {git = "git+https://github.com/mhdzumair/aioqbt.git"}
|
||||
cinemagoerng = {git = "git+https://github.com/mhdzumair/cinemagoerng.git"}
|
||||
Reference in New Issue
Block a user