diff --git a/.dockerignore b/.dockerignore index b05ba9d..8187574 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,6 +3,8 @@ node_modules/ npm-debug.log* yarn-debug.log* yarn-error.log* +# Let Docker generate platform-specific lockfile +package-lock.json # Build outputs dist/ diff --git a/.gitignore b/.gitignore index 56ec2ad..8f71597 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,8 @@ accounts.main.jsonc .DS_Store .playwright-chromium-installed *.log -.update-backup/ \ No newline at end of file +.update-backup/ + +# Exclude package-lock.json from repo for cross-platform compatibility +# Each platform (Windows/Linux/Raspberry Pi/Docker) generates its own +package-lock.json diff --git a/Dockerfile b/Dockerfile index 8f50a04..3694e3c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,10 +8,12 @@ WORKDIR /usr/src/microsoft-rewards-script ENV PLAYWRIGHT_BROWSERS_PATH=0 # Copy package files -COPY package.json package-lock.json tsconfig.json ./ +COPY package.json tsconfig.json ./ -# Install all dependencies required to build the script -RUN npm ci --ignore-scripts +# Generate fresh lockfile for target platform architecture +# This ensures native dependencies are resolved correctly +RUN npm install --ignore-scripts --package-lock-only \ + && npm ci --ignore-scripts # Copy source and build COPY . . diff --git a/docs/docker.md b/docs/docker.md index 9e2080d..3d82ef3 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -186,6 +186,21 @@ docker inspect --format='{{.State.Health.Status}}' microsoft-rewards-script ## ⚠️ Important Notes +### Platform Compatibility + +The Docker build **automatically generates platform-specific dependencies** for the target architecture: + +- ✅ **Windows (x86_64)** — Fully supported +- ✅ **Linux (x86_64)** — Fully supported +- ✅ **Raspberry Pi (ARM64)** — Fully supported +- ✅ **macOS (ARM64/Apple Silicon)** — Fully supported + +The build process regenerates `package-lock.json` inside the container to ensure native dependencies (Playwright, etc.) match the target platform. This means: + +- **No cross-platform compatibility issues** +- **Native performance on all architectures** +- **Raspberry Pi users won't encounter binary mismatch errors** + ### Buy Mode Not Supported **Buy Mode cannot be used in Docker** because it requires interactive terminal input. Use Buy Mode only in local installations: