diff --git a/.env.example b/.env.example index 0eb0039..79f9f93 100644 --- a/.env.example +++ b/.env.example @@ -57,4 +57,9 @@ EVENT_BUS_BACKEND=db # NATS_STREAM_NAME=MOVIES_DIARY_EVENTS # NATS_CONSUMER_NAME=worker +# Image conversion (optional — converts stored images to save disk space) +# Disable by default; enable in the worker by setting ENABLED=true. +# IMAGE_CONVERSION_ENABLED=false +# IMAGE_CONVERSION_FORMAT=avif # avif | webp + RUST_LOG=presentation=debug,tower_http=debug,worker=info,application=info diff --git a/Dockerfile b/Dockerfile index 87d1aa3..9a273e2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,12 +33,19 @@ COPY crates/adapters/tmdb-enrichment/Cargo.toml crates/adapters/tmdb-enrichmen COPY crates/domain/Cargo.toml crates/domain/Cargo.toml COPY crates/presentation/Cargo.toml crates/presentation/Cargo.toml COPY crates/tui/Cargo.toml crates/tui/Cargo.toml +COPY crates/adapters/image-converter/Cargo.toml crates/adapters/image-converter/Cargo.toml COPY crates/worker/Cargo.toml crates/worker/Cargo.toml # Stub every crate so cargo can resolve and fetch deps RUN find crates -name "Cargo.toml" | sed 's|/Cargo.toml||' | \ xargs -I{} sh -c 'mkdir -p {}/src && echo "fn main(){}" > {}/src/main.rs && echo "" > {}/src/lib.rs' +# libwebp-dev: required at build time by the `webp` crate (C bindings) +RUN apt-get update && apt-get install -y --no-install-recommends \ + libwebp-dev \ + pkg-config \ + && rm -rf /var/lib/apt/lists/* + RUN cargo fetch # Now copy real sources (invalidates cache only on source changes) @@ -60,6 +67,7 @@ FROM debian:bookworm-slim RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates \ wget \ + libwebp7 \ && rm -rf /var/lib/apt/lists/* WORKDIR /app diff --git a/README.md b/README.md index 31255e0..a8c06c6 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ adapters/ poster-fetcher — downloads poster images image-storage — stores images (posters + user avatars) on local filesystem or S3-compatible storage poster-sync — event handler: triggers poster fetch+store on MovieDiscovered + image-converter — optional background worker: converts stored images to AVIF or WebP; backfills existing images via a 24h periodic job tmdb-enrichment — event handler: fetches full movie profile (cast, crew, genres, keywords, box office) from TMDb on MovieEnrichmentRequested; resolves IMDb IDs automatically template-askama — Askama HTML rendering rss — RSS/Atom feed generation @@ -96,6 +97,10 @@ IMAGE_STORAGE_PATH=./images # MINIO_ACCESS_KEY_ID=minioadmin # MINIO_SECRET_ACCESS_KEY=minioadmin +# Image conversion (optional — converts stored images to AVIF or WebP to save space) +# IMAGE_CONVERSION_ENABLED=false +# IMAGE_CONVERSION_FORMAT=avif # avif or webp + # Optional HOST=0.0.0.0 PORT=3000