mirror of
https://github.com/TheNetsky/Microsoft-Rewards-Script.git
synced 2026-01-18 22:13:58 +00:00
Preliminary dockerization with scheduling (#406)
Porting working docker implementation (scheduling, etc.) into revised v2 Co-authored-by: Netsky <56271887+TheNetsky@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
8c8bdaf3e5
commit
49b607d78c
42
compose.yaml
42
compose.yaml
@@ -6,25 +6,37 @@ services:
|
||||
|
||||
# Volume mounts: Specify a location where you want to save the files on your local machine.
|
||||
volumes:
|
||||
- ./src/accounts.json:/usr/src/microsoft-rewards-script/accounts.json:ro
|
||||
- ./src/config.jsonc:/usr/src/microsoft-rewards-script/config.json:ro
|
||||
- ./sessions:/usr/src/microsoft-rewards-script/sessions # Optional, saves your login session
|
||||
- ./src/accounts.jsonc:/usr/src/microsoft-rewards-script/dist/accounts.json:ro
|
||||
- ./src/config.jsonc:/usr/src/microsoft-rewards-script/dist/config.json:ro
|
||||
- ./sessions:/usr/src/microsoft-rewards-script/dist/browser/sessions # Optional, saves your login session
|
||||
|
||||
environment:
|
||||
TZ: "America/Toronto" # Set your timezone for proper scheduling (used by image and scheduler)
|
||||
TZ: "America/Toronto" # Set your timezone for proper scheduling
|
||||
NODE_ENV: "production"
|
||||
# Force headless when running in Docker (uses Chromium Headless Shell only)
|
||||
FORCE_HEADLESS: "1"
|
||||
#SCHEDULER_DAILY_JITTER_MINUTES_MIN: "2"
|
||||
#SCHEDULER_DAILY_JITTER_MINUTES_MAX: "10"
|
||||
# Watchdog timeout per pass (minutes, default 180)
|
||||
#SCHEDULER_PASS_TIMEOUT_MINUTES: "180"
|
||||
# Run pass in child process (default true). Set to "false" to disable for debugging.
|
||||
#SCHEDULER_FORK_PER_PASS: "true"
|
||||
CRON_SCHEDULE: "0 7,16,20 * * *" # Customize your schedule, use crontab.guru for formatting
|
||||
RUN_ON_START: "true" # Runs the script immediately on container startup
|
||||
|
||||
# Add scheduled start-time randomization (uncomment to customize or disable, default: enabled)
|
||||
#MIN_SLEEP_MINUTES: "5"
|
||||
#MAX_SLEEP_MINUTES: "50"
|
||||
SKIP_RANDOM_SLEEP: "false"
|
||||
|
||||
# Optionally set how long to wait before killing a stuck script run (prevents blocking future runs, default: 8 hours)
|
||||
#STUCK_PROCESS_TIMEOUT_HOURS: "8"
|
||||
|
||||
# Optional resource limits for the container
|
||||
mem_limit: 4g
|
||||
cpus: 2
|
||||
|
||||
# Health check - monitors if cron daemon is running to ensure scheduled jobs can execute
|
||||
# Container marked unhealthy if cron process dies
|
||||
#healthcheck:
|
||||
test: ["CMD", "sh", "-c", "pgrep cron > /dev/null || exit 1"]
|
||||
interval: 60s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
|
||||
# Security hardening
|
||||
security_opt:
|
||||
- no-new-privileges:true
|
||||
|
||||
# Use the built-in scheduler by default; override with `command:` for one-shot runs
|
||||
command: ["npm", "run", "start"]
|
||||
|
||||
Reference in New Issue
Block a user