diff --git a/.github/workflows/build-push-backend.yml b/.github/workflows/build-push-backend.yml
index 2536145..51bc911 100644
--- a/.github/workflows/build-push-backend.yml
+++ b/.github/workflows/build-push-backend.yml
@@ -94,6 +94,16 @@ jobs:
type=semver,pattern={{major}}
type=sha
+ - name: Extract version
+ id: version
+ run: |
+ if [[ "${{ github.ref }}" == refs/tags/* ]]; then
+ VERSION=${GITHUB_REF#refs/tags/}
+ else
+ VERSION="dev-${GITHUB_SHA::7}"
+ fi
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
+
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
@@ -104,4 +114,4 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
- VERSION=${{ steps.meta.outputs.version }}
+ VERSION=${{ steps.version.outputs.version }}
diff --git a/.github/workflows/build-push-frontend.yml b/.github/workflows/build-push-frontend.yml
index 6473617..2c2e824 100644
--- a/.github/workflows/build-push-frontend.yml
+++ b/.github/workflows/build-push-frontend.yml
@@ -26,8 +26,10 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '20'
+ cache: 'npm'
+ cache-dependency-path: './web/package-lock.json'
- name: Install dependencies
- run: npm install
+ run: npm ci
working-directory: ./web
- name: Lint code
run: npm run lint
@@ -91,3 +93,5 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
build-args: |
VERSION=${{ steps.version.outputs.version }}
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
diff --git a/Dockerfile b/Dockerfile
index a880fca..8e510f2 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,23 +1,42 @@
+FROM ghcr.io/astral-sh/uv:debian-slim AS builder
+WORKDIR /app
+
+RUN apt-get update && \
+ apt-get install -y --no-install-recommends ca-certificates gcc python3-dev && \
+ apt-get clean && \
+ rm -rf /var/lib/apt/lists/*
+
+COPY pyproject.toml uv.lock ./
+
+RUN uv sync --locked
+
FROM ghcr.io/astral-sh/uv:debian-slim
ARG VERSION
LABEL version=${VERSION}
LABEL description="Docker image for the backend of MediaManager"
-ENV IMAGE_DIRECTORY=/data/images
-ENV TV_SHOW_DIRECTORY=/data/tv
-ENV MOVIE_DIRECTORY=/data/movies
-ENV TORRENT_DIRECTORY=/data/torrents
-ENV OPENID_ENABLED=FALSE
+ENV IMAGE_DIRECTORY=/data/images \
+ TV_SHOW_DIRECTORY=/data/tv \
+ MOVIE_DIRECTORY=/data/movies \
+ TORRENT_DIRECTORY=/data/torrents \
+ OPENID_ENABLED=FALSE \
+ PUBLIC_VERSION=${VERSION} \
+ UV_PROJECT_ENVIRONMENT=/app/.venv
-RUN apt update && apt install -y ca-certificates gcc python3-dev
+RUN apt-get update && \
+ apt-get install -y --no-install-recommends ca-certificates && \
+ apt-get clean && \
+ rm -rf /var/lib/apt/lists/*
WORKDIR /app
+
+COPY --from=builder /app/.venv /app/.venv
+COPY --from=builder /app/pyproject.toml /app/uv.lock ./
+
COPY --chmod=755 mediamanager-backend-startup.sh .
COPY media_manager ./media_manager
COPY alembic ./alembic
COPY alembic.ini .
-COPY pyproject.toml .
-COPY uv.lock .
-RUN uv sync --locked
+
EXPOSE 8000
CMD ["/app/mediamanager-backend-startup.sh"]
\ No newline at end of file
diff --git a/README.md b/README.md
index 45d67f6..c345d43 100644
--- a/README.md
+++ b/README.md
@@ -54,11 +54,14 @@ other services.
- [x] create separate metadata relay service, so that api keys for TMDB and TVDB are not strictly needed
- [x] support for movies
- [x] expand README with more information and a quickstart guide
+- [x] improve reliability of scheduled tasks
- [ ] add notification system
- [ ] add in-depth documentation on the architecture of the codebase
- [ ] make indexer module multithreaded
- [ ] add support for deluge and transmission
-- [ ] improve reliability of scheduled tasks
+- [ ] add delete button for movies/TV shows
+- [ ] rework prowlarr module (select which indexers to use, etc.)
+- [ ] add sequence diagrams to the documentation
- [ ] _maybe_ rework the logo
- [ ] _maybe_ add support for configuration via toml config file
diff --git a/media_manager/main.py b/media_manager/main.py
index b2a37ea..75984dd 100644
--- a/media_manager/main.py
+++ b/media_manager/main.py
@@ -131,7 +131,7 @@ weekly_trigger = CronTrigger(
day_of_week="mon", hour=0, minute=0, jitter=60 * 60 * 24 * 2
)
scheduler.add_job(hourly_tasks, trigger)
-scheduler.add_job(weekly_tasks, trigger)
+scheduler.add_job(weekly_tasks, weekly_trigger)
scheduler.start()
@@ -288,5 +288,13 @@ except Exception as e:
log.error(f"Error creating test directory: {e}")
raise
+
+@app.get("/")
+async def hello_world() -> dict:
+ """
+ A simple endpoint to check if the API is running.
+ """
+ return {"message": "Hello World!", "version": os.getenv("PUBLIC_VERSION")}
+
if __name__ == "__main__":
uvicorn.run(app, host="127.0.0.1", port=5049, log_config=LOGGING_CONFIG)
diff --git a/media_manager/movies/router.py b/media_manager/movies/router.py
index a65c877..34bd7cf 100644
--- a/media_manager/movies/router.py
+++ b/media_manager/movies/router.py
@@ -241,10 +241,13 @@ def get_all_available_torrents_for_a_movie(
def download_torrent_for_movie(
movie_service: movie_service_dep,
movie_id: MovieId,
- indexer_result_id: IndexerQueryResultId,
+ public_indexer_result_id: IndexerQueryResultId,
+ override_file_path_suffix: str = "",
):
return movie_service.download_torrent(
- public_indexer_result_id=indexer_result_id, movie_id=movie_id
+ public_indexer_result_id=public_indexer_result_id,
+ movie_id=movie_id,
+ override_movie_file_path_suffix=override_file_path_suffix,
)
diff --git a/mediamanager-backend-startup.sh b/mediamanager-backend-startup.sh
index 2b8c59d..169b803 100644
--- a/mediamanager-backend-startup.sh
+++ b/mediamanager-backend-startup.sh
@@ -1,4 +1,20 @@
#!/bin/bash
# This script is used to start the MediaManager backend service.
+
+
+# text created with https://patorjk.com/software/taag/ font: Slanted
+echo "
+ __ ___ ___ __ ___ ____ __ __
+ / |/ /__ ____/ (_)___ _/ |/ /___ _____ ____ _____ ____ _____ / __ )____ ______/ /_____ ____ ____/ /
+ / /|_/ / _ \/ __ / / __ \`/ /|_/ / __ \`/ __ \/ __ \`/ __ \`/ _ \/ ___/ / __ / __ \`/ ___/ //_/ _ \/ __ \/ __ /
+ / / / / __/ /_/ / / /_/ / / / / /_/ / / / / /_/ / /_/ / __/ / / /_/ / /_/ / /__/ ,< / __/ / / / /_/ /
+/_/ /_/\___/\__,_/_/\__,_/_/ /_/\__,_/_/ /_/\__,_/\__, /\___/_/ /_____/\__,_/\___/_/|_|\___/_/ /_/\__,_/
+ /____/
+"
+echo "Buy me a coffee at https://buymeacoffee.com/maxdorninger"
+echo "Running DB migrations..."
+
uv run alembic upgrade head
-uv run fastapi run /app/media_manager/main.py
\ No newline at end of file
+
+echo "Starting MediaManager backend service..."
+uv run fastapi run /app/media_manager/main.py --port 8000
diff --git a/web/Dockerfile b/web/Dockerfile
index 994f598..11ab5e5 100644
--- a/web/Dockerfile
+++ b/web/Dockerfile
@@ -1,28 +1,39 @@
ARG VERSION
ARG BASE_URL=""
FROM node:24-alpine AS build
-USER node:node
WORKDIR /app
+ARG VERSION
+ARG BASE_URL
-COPY --chown=node:node . .
+# Copy package files first for better layer caching
+COPY package*.json ./
+RUN npm ci && npm cache clean --force
-RUN npm ci
+# Copy source code after dependencies are installed
+COPY . .
RUN env PUBLIC_VERSION=${VERSION} BASE_URL=${BASE_URL} npm run build
FROM node:24-alpine AS frontend
ARG VERSION
-USER node:node
+
+USER node
+EXPOSE 3000
+WORKDIR /app
+
LABEL version=${VERSION}
LABEL description="Docker image for the web frontend of MediaManager"
+
ENV PUBLIC_VERSION=${VERSION}
ENV PUBLIC_SSR_WEB=false
-WORKDIR /app
-COPY --chown=node:node package*.json ./
-COPY --chown=node:node --from=build /app/node_modules ./node_modules/
-COPY --chown=node:node --from=build /app/build/ ./build/
+# Copy built application and package files
+COPY --from=build /app/build ./build
+COPY --from=build /app/package*.json ./
+COPY --chmod=755 entrypoint.sh .
-EXPOSE 3000
+# Install only production dependencies needed for the Node adapter
+RUN npm ci --only=production && npm cache clean --force
+
+CMD ["/app/entrypoint.sh"]
-CMD ["node","build/index.js"]
diff --git a/web/entrypoint.sh b/web/entrypoint.sh
new file mode 100644
index 0000000..0acf8d1
--- /dev/null
+++ b/web/entrypoint.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+# This script is used to start the MediaManager frontend service.
+
+
+# text created with https://patorjk.com/software/taag/ font: Slanted
+cat << EOF
+ __ ___ ___ __ ___ ______ __ __
+ / |/ /__ ____/ (_)___ _/ |/ /___ _____ ____ _____ ____ _____ / ____/________ ____ / /____ ____ ____/ /
+ / /|_/ / _ \/ __ / / __ \`/ /|_/ / __ \`/ __ \/ __ \`/ __ \`/ _ \/ ___/ / /_ / ___/ __ \/ __ \/ __/ _ \/ __ \/ __ /
+ / / / / __/ /_/ / / /_/ / / / / /_/ / / / / /_/ / /_/ / __/ / / __/ / / / /_/ / / / / /_/ __/ / / / /_/ /
+/_/ /_/\___/\__,_/_/\__,_/_/ /_/\__,_/_/ /_/\__,_/\__, /\___/_/ /_/ /_/ \____/_/ /_/\__/\___/_/ /_/\__,_/
+ /____/
+EOF
+echo "Buy me a coffee at https://buymeacoffee.com/maxdorninger"
+echo "Starting MediaManager frontend service..."
+node build/index.js
diff --git a/web/src/lib/components/app-sidebar.svelte b/web/src/lib/components/app-sidebar.svelte
index fe49617..d533f95 100644
--- a/web/src/lib/components/app-sidebar.svelte
+++ b/web/src/lib/components/app-sidebar.svelte
@@ -99,7 +99,7 @@