Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
11 changes: 11 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# .dockerignore
node_modules
vendor
.git
test-srts
*.log
CODEBASE_REFERENCE.md
docker-compose.dev.yaml
subsyncarr-plus.db
builds
testlogs
2 changes: 0 additions & 2 deletions .env.example

This file was deleted.

36 changes: 23 additions & 13 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
images: mrorbitman/subsyncarr
images: tomtomw123/subsyncarr-plus
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
Expand Down Expand Up @@ -64,27 +64,37 @@ jobs:

Pull the image using:
```bash
docker pull mrorbitman/subsyncarr:${{ github.ref_name }}
docker pull tomtomw123/subsyncarr-plus:${{ github.ref_name }}
# or
docker pull mrorbitman/subsyncarr:latest
docker pull tomtomw123/subsyncarr-plus:latest
```

Example docker-compose.yaml:

```
version: "3.8"
name: subsyncarr-plus

services:
subsyncarr:
image: mrorbitman/subsyncarr:latest
container_name: subsyncarr
volumes:
- ${MEDIA_PATH:-/path/to/your/media}:/scan_dir
restart: unless-stopped
environment:
- TZ=${TZ:-UTC}
subsyncarr-plus:
image: tomtomw123/subsyncarr-plus:latest
container_name: subsyncarr-plus
volumes:
# Any path configured with SCAN_PATHS env var must be mounted
# If no scan paths are specified, it defaults to scan `/scan_dir` like example below.
# - ${MEDIA_PATH:-/path/to/your/media}:/scan_dir
- /path/to/movies:/movies
- /path/to/tv:/tv
- /path/to/anime:/anime
restart: unless-stopped
environment:
- TZ=${TZ:-UTC}
- CRON_SCHEDULE=0 0 * * * # Runs every day at midnight by default
- SCAN_PATHS=/movies,/tv,/anime # Remember to mount these as volumes. Must begin with /. Default valus is `/scan_dir`
- EXCLUDE_PATHS=/movies/temp,/tv/downloads # Exclude certain sub-directories from the scan
- MAX_CONCURRENT_SYNC_TASKS=1
- INCLUDE_ENGINES=ffsubsync,autosubsync # If not set, all engines are used by default
```

Docker Hub URL: https://hub.docker.com/r/mrorbitman/subsyncarr/tags
Docker Hub URL: https://hub.docker.com/r/tomtomw123/subsyncarr-plus/tags
draft: false
prerelease: false
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,12 @@
/dist
/coverage
.eslintcache
.env
.env
/test-srts
CODEBASE_REFERENCE.md
docker-compose.dev.yaml
subsyncarr-plus.db
builds
*.tar
*.tar.gz
testlogs
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ dist
.prettierignore
.husky
Dockerfile
.env*
.env*
/app
92 changes: 54 additions & 38 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,63 +1,79 @@
# Use Node.js LTS (Long Term Support) as base image
FROM node:20-bullseye

# Set working directory
WORKDIR /app
# Create app user and group with configurable UID/GID
ENV PUID=1000
ENV PGID=1000

RUN mkdir -p /app
RUN chown node:node /app

# Modify existing node user instead of creating new one
RUN groupmod -g ${PGID} node && \
usermod -u ${PUID} -g ${PGID} node && \
chown -R node:node /home/node
RUN apt-get clean

# Install system dependencies including ffmpeg, Python, and cron
# Install system dependencies including ffmpeg, Python, cron, and build tools
RUN apt-get update && apt-get install -y \
ffmpeg \
python3 \
python3-pip \
python3-venv \
cron \
build-essential \
&& rm -rf /var/lib/apt/lists/*

# Install pipx
RUN python3 -m pip install --user pipx \
&& python3 -m pipx ensurepath

# Add pipx to PATH
ENV PATH="/root/.local/bin:$PATH"

# Install ffsubsync and autosubsync using pipx
RUN pipx install ffsubsync \
&& pipx install autosubsync
USER node
# Set working directory
WORKDIR /app

# Copy package.json and package-lock.json (if available)
COPY package*.json ./
COPY --chown=node:node package*.json ./

# Install Node.js dependencies while skipping husky installation
ENV HUSKY=0
RUN npm install --ignore-scripts

# Rebuild native modules for the container's platform
RUN npm rebuild better-sqlite3

# Copy the rest of your application
COPY . .
COPY --chown=node:node . .
RUN mkdir -p /home/node/.local/bin/
RUN cp bin/* /home/node/.local/bin/

# Build TypeScript
RUN npm run build

# Create data directory for SQLite database
RUN mkdir -p /app/data && chown node:node /app/data

# Create startup script
RUN echo '#!/bin/bash\n\
# Add cron job\n\
echo "0 0 * * * cd /app && /usr/local/bin/node /app/dist/index.js >> /var/log/cron.log 2>&1" > /etc/cron.d/subsyncarr\n\
chmod 0644 /etc/cron.d/subsyncarr\n\
crontab /etc/cron.d/subsyncarr\n\
\n\
# Start cron\n\
service cron start\n\
\n\
# Run the initial instance of the app\n\
node dist/index.js\n\
\n\
# Keep container running\n\
tail -f /var/log/cron.log' > /app/startup.sh

# Make startup script executable
RUN chmod +x /app/startup.sh

# Create log file
RUN touch /var/log/cron.log

# Use startup script as entrypoint
CMD ["/app/startup.sh"]
# Set default cron schedule (if not provided by environment variable)
ENV CRON_SCHEDULE="0 0 * * *"

# Install pipx
RUN python3 -m pip install --user pipx \
&& python3 -m pipx ensurepath

# Add pipx to PATH
ENV PATH="/home/node/.local/bin:$PATH"

# Install ffsubsync and autosubsync using pipx
# Clean caches after installation to reduce memory footprint
RUN pipx install ffsubsync \
&& pipx install autosubsync \
&& python3 -m pip cache purge \
&& find /home/node/.local/share/pipx -type f -name "*.pyc" -delete 2>/dev/null || true \
&& find /home/node/.local/share/pipx -type d -name "__pycache__" -delete 2>/dev/null || true

# Expose web UI port
EXPOSE 3000

# Use server as entrypoint (which includes cron scheduling)
# Memory optimization flags: increased heap to 512MB to prevent OOM with file-based logging
CMD ["node", \
"--max-old-space-size=512", \
"--optimize-for-size", \
"dist/index-server.js"]
Loading