- Change Dockerfile to run as root instead of peikarband user
- Update Helm values.yaml to use root user (runAsUser: 0, runAsNonRoot: false)
- Improve entrypoint.sh permission handling with reusable function
- Add reflex init before run if packages not installed
- Fix node_modules/.bin permissions for symlinks and targets
This resolves the 'react-router: Permission denied' error by running
containers with root privileges. TODO: Switch back to non-root user
after permission issues are fully resolved.
- Add state_auto_setters=True to rxconfig.py (fixes Reflex 0.8.9+ deprecation)
- Fix node_modules/.bin permissions in Dockerfile (both files and symlinks)
- Add permission validation in entrypoint.sh
- Fix healthcheck endpoint from /_health to /ping on port 8000
- Add diagnostic commands to Dockerfile for debugging
- Improve permission handling in builder and runtime stages
Fixes permission denied error for react-router during production build
- Reflex نیاز دارد که در directory حاوی rxconfig.py اجرا شود
- WORKDIR به /app/peikarband برگردانده شد
- PYTHONPATH=/app:/app/peikarband برای پیدا کردن peikarband package
- تست کامل انجام شده
- تغییر WORKDIR از /app/peikarband به /app
- این باعث میشود Python بتواند peikarband package را از /app/peikarband پیدا کند
- REFLEX_DIR=/app/peikarband برای پیدا کردن rxconfig.py
- تست کامل انجام شده
- تغییر WORKDIR به /app/peikarband تا Reflex بتواند rxconfig.py را پیدا کند
- اضافه کردن کد در peikarband/__init__.py برای ثبت peikarband.peikarband در sys.modules
- این کد peikarband.peikarband را به صورت خودکار load میکند وقتی peikarband package import میشود
- تست کامل انجام شده
- تغییر WORKDIR از /app/peikarband به /app تا Python بتواند peikarband package را پیدا کند
- استفاده از importlib در peikarband/peikarband/__init__.py برای load مستقیم app.py
- این راه حل کار میکند حتی وقتی Reflex از /app/peikarband directory اجرا میشود
- REFLEX_DIR=/app/peikarband تنظیم شده تا Reflex بتواند rxconfig.py را پیدا کند
- تست کامل انجام شده و همه چیز درست کار میکند
- تغییر peikarband/peikarband/__init__.py برای استفاده از absolute import (from peikarband.app)
- اضافه کردن تست import در Dockerfile قبل از reflex export
- این راه حل با PYTHONPATH=/build:/build/peikarband کار میکند
- تست کامل انجام شده و همه چیز درست کار میکند
- حذف peikarband.py که با peikarband/ directory تداخل داشت
- بهروزرسانی __init__.py برای ایجاد peikarband.peikarband submodule
- بهروزرسانی PYTHONPATH در Dockerfile برای پشتیبانی از src.* imports
- این تغییرات باعث میشود Reflex بتواند peikarband.peikarband را پیدا کند
- ایجاد peikarband/__init__.py برای فعالسازی package
- ایجاد peikarband/peikarband.py برای export کردن app
- تغییر Dockerfile برای حفظ ساختار peikarband package در /build/peikarband/ و /app/peikarband/
- بهروزرسانی مسیرهای reflex commands و REFLEX_DIR
- این تغییرات باعث میشود Reflex بتواند peikarband.peikarband را پیدا کند
- Re-declare ARG variables (VERSION, BUILD_DATE, GIT_COMMIT, etc.) in runtime stage
- Fixes UndefinedVar warnings for BUILD_DATE and VERSION
- ARG variables must be declared in each stage where they are used
- Export app from src/__init__.py so Reflex can find it
- Set app_name to 'src' in rxconfig.py to match module structure
- Remove .npmrc before setting npm registry to avoid mirror override
- Add registry verification in Dockerfile
- Fixes ModuleNotFoundError and npm registry issues
- Set PYTHONPATH to /build for Reflex to find app module
- Update app_name in rxconfig.py to match actual module path
- Configure npm to use registry.npmjs.org instead of mirror
- Add fallback from npm ci to npm install on failure
- Fixes ModuleNotFoundError: Module peikarband.peikarband not found
All dependencies now in base image:
✅ Python 3.11
✅ Node.js 20
✅ bun, npm
✅ Build tools (gcc, g++, make)
✅ Runtime essentials (curl, ca-certificates)
✅ tini (init system)
Result:
• Runtime stage needs ZERO installations
• Just copy files from builder
• Pure base image usage 🚀
Problem: Runtime stage was installing Node.js again!
Solution: Use base image for runtime too
- Already has Python 3.11 ✅
- Already has Node.js 20 ✅
- Already has curl, ca-certificates ✅
- Only install tini (tiny)
This is the CORRECT way to use base image!
Changes:
✅ Dockerfile now uses base image
✅ Helper script to build base locally
✅ Complete documentation
Base image contains heavy dependencies:
- Python 3.11
- Node.js 20
- bun, npm
- Build tools (gcc, g++, make)
Build times:
• First time: 10 minutes (build base)
• After that: 3 minutes (code only) 🚀
To build base image:
./build-base-local.sh
Then normal builds are FAST!
Problem: Docker-in-Docker doesn't work in Woodpecker alpine image
Solution:
- Dockerfile now self-contained (installs Node.js, bun directly)
- No dependency on external base image
- Build always works
- Simpler and more reliable
Trade-off:
- Build time: ~8-10 minutes (but reliable)
- No complex base image management
- Easier to maintain
For future optimization:
- Use .woodpecker-base.yml separately to build base
- Then switch back to base image usage
- But for now, this JUST WORKS