| FROM python:3.11-slim | |
| # Install dependencies | |
| RUN apt update && apt install -y \ | |
| gcc \ | |
| curl \ | |
| sudo \ | |
| git-lfs \ | |
| openssl \ | |
| jq \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Install Python packages | |
| RUN pip install --no-cache-dir \ | |
| huggingface_hub \ | |
| datasets | |
| # Add health check | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ | |
| CMD curl -f http://localhost:7860/ || exit 1 | |
| COPY config.toml /app/readeck/config.toml | |
| # --- ADD THIS LINE TO FIX PERMISSION ISSUES --- | |
| # This command changes the file permissions to be readable and writable by everyone. | |
| # This is a common fix for permission denied errors, especially if the application | |
| # needs to write to the config file or if the user running the app is unknown. | |
| # If config.toml is only read by the application, 'chmod 644' might be sufficient and more secure. | |
| # However, for debugging and ensuring it runs, '666' is a good start. | |
| RUN chmod 666 /app/readeck/config.toml | |
| # --- NEW ADDITION FOR DATA DIRECTORY PERMISSIONS --- | |
| # Create the 'data' directory and set permissions to allow writing by any user. | |
| # This ensures the application, even if running as a non-root user, | |
| # can create and write files (like db.sqlite3) within this directory. | |
| #RUN mkdir -p /app/readeck/data && chmod 777 /app/readeck/data | |
| # Copy sync scripts | |
| COPY sync_storage.py /app/sync_storage.py | |
| COPY start_with_sync.sh /start.sh | |
| # Make scripts executable | |
| RUN chmod +x /app/sync_storage.py /start.sh | |
| # Start with sync | |
| # Set working directory | |
| WORKDIR /tmp | |
| RUN readeck_url=$(curl -X 'GET' 'https://codeberg.org/api/v1/repos/readeck/readeck/releases/latest' -H 'accept: application/json' | jq -r '.assets[] | .browser_download_url | select(. | endswith("linux-amd64"))') && \ | |
| echo download readeck from $readeck_url && \ | |
| curl -q $readeck_url -o /bin/readeck &&\ | |
| chmod a+x /bin/readeck | |
| ENTRYPOINT ["/start.sh"] | |
| # CMD ["/bin/readeck","serve", "-config", "/app/readeck/config.toml"] | |