File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ node_modules
2+ data
3+ .env
4+ npm-debug.log
5+ Dockerfile
6+ docker-compose.yml
7+ .git
8+ test
9+ README.md
Original file line number Diff line number Diff line change 1+ PORT = 8085
2+ # Cache TTL in seconds (default 86400 = 1 day)
3+ CACHE_TTL = 86400
4+ JELLYFIN_URL = YOUR_JELLYFIN_URL
5+ JELLYFIN_API_KEY = YOUR_JELLYFIN_API_KEY
6+ # Optional: set a custom Puppeteer executable path if you provide system Chromium
7+ # PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
8+
9+ # Debug: set to true to persist debug screenshots inside the container `data/` folder
10+ # Useful for troubleshooting but should remain false in normal operation.
11+ DEBUG_SCREENSHOTS = false
Original file line number Diff line number Diff line change 1+ name : Publish Docker image to GHCR
2+
3+ on :
4+ push :
5+ branches : ["main"]
6+ tags :
7+ - ' v*'
8+ workflow_dispatch : {}
9+
10+ permissions :
11+ contents : read
12+ packages : write
13+
14+ jobs :
15+ build-and-push :
16+ name : Build and publish image
17+ runs-on : ubuntu-latest
18+
19+ steps :
20+ - name : Checkout
21+ uses : actions/checkout@v4
22+
23+ - name : Set up QEMU
24+ uses : docker/setup-qemu-action@v2
25+
26+ - name : Set up Docker Buildx
27+ uses : docker/setup-buildx-action@v2
28+
29+ - name : Login to GHCR
30+ uses : docker/login-action@v2
31+ with :
32+ registry : ghcr.io
33+ username : ${{ github.actor }}
34+ password : ${{ secrets.GITHUB_TOKEN }}
35+
36+ - name : Determine image name and tags
37+ id : meta
38+ run : |
39+ IMAGE="ghcr.io/${{ github.repository_owner }}/filmaffinity-scores"
40+ TAGS="${IMAGE}:latest ${IMAGE}:${{ github.sha }}"
41+ if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
42+ TAG_NAME=${GITHUB_REF#refs/tags/}
43+ TAGS="${TAGS} ${IMAGE}:${TAG_NAME}"
44+ fi
45+ echo "image=${IMAGE}" >> $GITHUB_OUTPUT
46+ echo "tags=${TAGS}" >> $GITHUB_OUTPUT
47+
48+ - name : Build and push
49+ uses : docker/build-push-action@v4
50+ with :
51+ context : .
52+ push : true
53+ platforms : linux/amd64,linux/arm64
54+ tags : ${{ steps.meta.outputs.tags }}
Original file line number Diff line number Diff line change 1+ # Docker usage
2+
3+ Requirements: Docker and Docker Compose installed.
4+
5+ How to build the image
6+
7+ ``` bash
8+ docker build -t filmaffinity-scores .
9+ ```
10+
11+ How to run with docker-compose
12+
13+ 1 . Copy ` .env.example ` to ` .env ` and edit values if needed.
14+ 2 . Start the app:
15+
16+ ``` bash
17+ docker compose up --build
18+ ```
19+
20+ This mounts the local ` data/ ` folder into the container to persist cache between runs.
21+
22+ Environment variables reference
23+
24+ - ` PORT ` : port in container and host mapping (default ` 8085 ` ).
25+ - ` CACHE_TTL ` : cache TTL seconds (default ` 86400 ` ).
26+ - ` JELLYFIN_URL ` : your jellyfin url.
27+ - ` JELLYFIN_API_KEY ` : your jellyfin api key.
28+ - ` PUPPETEER_EXECUTABLE_PATH ` : optional — set only if you want to use a system-installed Chromium.
29+ - ` DEBUG_SCREENSHOTS ` : set to ` true ` to persist debug screenshots under the ` data/ ` folder inside the container (disabled by default).
30+
31+ Notes on Puppeteer
32+
33+ - The image installs runtime libraries required by Chromium; Puppeteer will download a compatible Chromium during ` npm install ` inside the image.
34+ - If you encounter Chromium sandbox issues, try launching Puppeteer with ` --no-sandbox --disable-setuid-sandbox ` flags or set ` PUPPETEER_EXECUTABLE_PATH ` to a system Chromium binary.
35+
36+ Validation
37+
38+ - The compose service exposes the app on ` http://localhost:PORT ` .
39+ - Data is persisted in ` ./data/ratings.json ` .
Original file line number Diff line number Diff line change 1- FROM node:20-alpine
2- RUN apk add --no-cache \
3- chromium \
4- nss \
5- freetype \
6- harfbuzz \
7- ca-certificates \
8- ttf-freefont
1+ FROM node:20-slim
2+
3+ # Install dependencies required by Chromium / Puppeteer
4+ RUN apt-get update \
5+ && apt-get install -y --no-install-recommends \
6+ ca-certificates \
7+ fonts-liberation \
8+ libappindicator3-1 \
9+ libasound2 \
10+ libatk-bridge2.0-0 \
11+ libatk1.0-0 \
12+ libcups2 \
13+ libdbus-1-3 \
14+ libdrm2 \
15+ libgbm1 \
16+ libgdk-pixbuf2.0-0 \
17+ libgtk-3-0 \
18+ libnspr4 \
19+ libnss3 \
20+ libx11-xcb1 \
21+ libxcomposite1 \
22+ libxdamage1 \
23+ libxrandr2 \
24+ libxss1 \
25+ lsb-release \
26+ xdg-utils \
27+ wget \
28+ && rm -rf /var/lib/apt/lists/*
929
10- ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
11- ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
1230WORKDIR /app
31+
32+ # Copy package files first for install caching
1333COPY package*.json ./
14- RUN npm install --omit=dev
34+
35+ # Let Puppeteer download Chromium (bundled) and install only production deps
36+ ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=false
37+ ENV NODE_ENV=production
38+ RUN npm ci --only=production
39+
40+ # Copy source
1541COPY . .
42+
1643EXPOSE 8085
1744CMD ["npm" , "start" ]
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ npm start
4141The API will be available at:
4242
4343``` bash
44- http://localhost:3000
44+ http://localhost:8085
4545```
4646
4747---
@@ -83,9 +83,19 @@ curl "http://localhost:3000/movie?title=Inception&year=2010"
8383
8484---
8585
86- ## 🐳 Docker (coming soon)
86+ ## 🐳 Docker
8787
88- Docker support is planned to simplify deployment in home server environments.
88+ See [ DOCKER.md] ( DOCKER.md ) for build and run instructions using Docker and Docker Compose.
89+
90+ ** Published image**
91+
92+ Official images are published to GitHub Container Registry at ` ghcr.io/Cruzadera/filmaffinity-scores ` by CI. To pull:
93+
94+ ``` bash
95+ docker pull ghcr.io/Cruzadera/filmaffinity-scores:latest
96+ ```
97+
98+ Replace ` Cruzadera ` with the GitHub user or organization that hosts the repository.
8999
90100---
91101
Original file line number Diff line number Diff line change 1+ version : " 3.8"
2+
3+ services :
4+ app :
5+ build :
6+ context : .
7+ env_file :
8+ - .env
9+ ports :
10+ - " ${PORT:-8085}:8085"
11+ volumes :
12+ - ./data:/app/data
13+ restart : unless-stopped
14+ shm_size : ' 1gb'
You can’t perform that action at this time.
0 commit comments