A lightweight FacturaScripts Docker image built on Alpine Linux. (~30MB)
Repository: https://github.com/erseco/alpine-facturascripts
- Built on the lightweight image erseco/alpine-php-webserver
- Compact Docker image size (~30MB)
- Uses PHP 8.4 FPM for better performance, lower CPU usage & memory footprint
- Unattended Installation - skip the web installer with environment variables
- Automatic Plugin Installation - install plugins on first startup via
FS_PLUGINS - Automatic Cron Tasks - hourly scheduled tasks via dcron (can be disabled)
- Configurable via environment variables (see Configuration section)
- Multi-arch Support:
amd64,arm/v6,arm/v7,arm64,ppc64le,s390x - Optimized to only use resources when there's traffic (by using PHP-FPM's ondemand process manager)
- Uses runit instead of supervisord to reduce memory footprint
- Services run under a non-privileged user (
nobody) for improved security - Logs are sent to container's STDOUT (
docker logs -f <container>) - Extensible via pre/post configuration hooks
- Follows the KISS principle (Keep It Simple, Stupid) to make it easy to understand and adjust
FacturaScripts is a free and open-source accounting and billing software for small and medium-sized businesses. It offers features like:
- Invoicing and billing
- Inventory management
- Customer and supplier management
- Reports and statistics
- Plugin system for extensibility
- Multi-company support
Learn more at https://facturascripts.com
- Change default credentials: Always override
FS_INITIAL_USERandFS_INITIAL_PASSwith secure values. - First startup: The first time you start the container, FacturaScripts will rebuild its dynamic classes. This may take a few seconds.
- Database permissions: Ensure the database user has permissions to create tables and modify the database structure.
docker compose upLog in using the credentials defined by environment variables.
services:
facturascripts:
image: ghcr.io/erseco/alpine-facturascripts
# rest of your configIn certain situations, you might need to run commands as root within your FacturaScripts container, for example, to install additional packages. You can do this using the docker compose exec command with the --user root option:
docker compose exec --user root facturascripts shHere is a minimal docker-compose.yml example with unattended installation:
---
services:
mariadb:
image: mariadb:lts
restart: unless-stopped
environment:
- MYSQL_ROOT_PASSWORD=facturascripts
- MYSQL_DATABASE=facturascripts
- MYSQL_USER=facturascripts
- MYSQL_PASSWORD=facturascripts
volumes:
- mariadb_data:/var/lib/mysql
facturascripts:
image: erseco/alpine-facturascripts:latest
restart: unless-stopped
ports:
- "8080:8080"
environment:
# Database Connection
DB_HOST: mariadb
DB_NAME: facturascripts
DB_USER: facturascripts
DB_PASSWORD: facturascripts
# Initial Setup (for unattended installation)
FS_INITIAL_USER: admin
FS_INITIAL_PASS: ChangeMe123!
FS_LANG: es_ES
FS_TIMEZONE: Europe/Madrid
volumes:
- facturascripts_data:/var/www/html/volume
depends_on:
- mariadb
volumes:
mariadb_data: null
facturascripts_data: nullWith this configuration, FacturaScripts will be automatically installed and ready to use. Just access http://localhost:8080 and log in with admin / ChangeMe123!
To start the services, run:
docker compose upOnce the container is running, FacturaScripts will be accessible at http://localhost:8080.
This image supports unattended installation, which means FacturaScripts will be automatically configured and ready to use without manual intervention.
When you provide the FS_INITIAL_USER and FS_INITIAL_PASS environment variables, the installation wizard will be completely skipped:
- Start the container:
docker compose up - Wait for the database initialization (first time only)
- Access
http://localhost:8080and log in with your credentials - Done! FacturaScripts is ready to use
The container automatically creates:
- Complete
config.phpwith all necessary settings .htaccessfile for URL rewriting- Required folders (
MyFiles,Plugins,Dinamic) - Database tables and initial user
If you don't provide FS_INITIAL_USER and FS_INITIAL_PASS, the standard installation wizard will appear on first access:
- Open your browser and navigate to
http://localhost:8080 - The installation wizard will guide you through:
- Database verification (already configured via environment variables)
- Creating an administrator user
- Language and timezone selection
- Initial configuration
You can configure the container using the following environment variables in your docker-compose.yml file.
| Variable Name | Description | Default |
|---|---|---|
DB_TYPE |
Database type (mysql/postgresql) | mysql |
DB_HOST |
Database host | null |
DB_PORT |
Database port | 3306 |
DB_USER |
Database user | null |
DB_PASSWORD |
Database password | null |
DB_NAME |
Database name | null |
| Variable Name | Description | Default | Required for Auto-Install |
|---|---|---|---|
FS_INITIAL_USER |
Initial admin username | null |
Yes |
FS_INITIAL_PASS |
Initial admin password | null |
Yes |
FS_LANG |
Interface language (es_ES, en_EN, etc) | es_ES |
No |
FS_TIMEZONE |
Timezone (e.g., Europe/Madrid, UTC) | UTC |
No |
Important: To enable unattended installation, you must set both FS_INITIAL_USER and FS_INITIAL_PASS. If these variables are not set, the web installer will appear.
| Variable Name | Description | Default |
|---|---|---|
FS_COOKIES_EXPIRE |
Cookie expiration time in seconds | 31536000 (1 year) |
FS_ROUTE |
Subdirectory path if not in root | "" (root) |
FS_DB_FOREIGN_KEYS |
Enable foreign key constraints | true |
FS_DB_TYPE_CHECK |
Enable database type checking | true |
FS_MYSQL_CHARSET |
MySQL character set (MySQL only) | utf8mb4 |
FS_MYSQL_COLLATE |
MySQL collation (MySQL only) | utf8mb4_unicode_520_ci |
FS_PGSQL_SSL |
PostgreSQL SSL mode (PostgreSQL only) | "" |
FS_PGSQL_ENDPOINT |
PostgreSQL endpoint (PostgreSQL only) | "" |
FS_DEBUG |
Enable debug mode | false |
FS_HIDDEN_PLUGINS |
Comma-separated list of hidden plugins | "" |
FS_DISABLE_RM_PLUGINS |
Disable plugin removal | false |
FS_DISABLE_ADD_PLUGINS |
Disable plugin installation | false |
FS_DISABLE_RM_USERS |
Disable user removal | false |
FS_PLUGINS |
Space-separated list of plugins to install | "" |
Note about FS_PLUGINS: Supports plugin names, download IDs, or full URLs. Plugins are installed only on first startup. See "Automatic Plugin Installation" section for details.
| Variable Name | Description | Default |
|---|---|---|
APPLICATION_ENV |
Set to development for debug mode |
production |
memory_limit |
PHP memory limit | 512M |
upload_max_filesize |
Max size for uploaded files | 64M |
post_max_size |
Max size of POST data | 64M |
max_execution_time |
PHP max execution time in seconds | 300 |
| Variable Name | Description | Default |
|---|---|---|
PRE_CONFIGURE_COMMANDS |
Commands to run before starting the configuration | |
POST_CONFIGURE_COMMANDS |
Commands to run after finishing the configuration | |
RUN_CRON_TASKS |
Enable/disable automatic cron tasks | true |
CRON_INTERVAL |
Cron schedule expression for FacturaScripts tasks | 0 * * * * |
Calling docker compose build uses the latest stable version of FacturaScripts (2025.5). If you need to use a specific FacturaScripts version, you can specify it using the FS_VERSION build argument.
To use a specific version, edit the build section for the facturascripts service in your docker-compose.yml file:
facturascripts:
image: erseco/alpine-facturascripts
build:
context: .
args:
FS_VERSION: 2025.4 # Replace with your desired versionAvailable versions can be found at https://facturascripts.com/descargas
After changing the version, rebuild the image:
docker compose build facturascriptsYou can define commands to be executed before and after the configuration of FacturaScripts using the PRE_CONFIGURE_COMMANDS and POST_CONFIGURE_COMMANDS environment variables. These can be useful for tasks such as installing additional packages or running scripts.
environment:
PRE_CONFIGURE_COMMANDS: "cat /var/www/html/htaccess-sample"
POST_CONFIGURE_COMMANDS: |
echo 'FacturaScripts configured successfully'
# Add any post-installation tasks hereThis image supports automatic plugin installation on first startup, similar to the Omeka-S image. You can specify which plugins to install using the FS_PLUGINS environment variable.
The FS_PLUGINS variable accepts plugins in multiple formats:
-
Plugin Names (mapped to download IDs):
FS_PLUGINS: "verifactu multiempresa webportal"
-
Download IDs (numeric):
FS_PLUGINS: "448 464 460"
-
Full URLs:
FS_PLUGINS: "https://facturascripts.com/DownloadBuild/448/stable"
-
Mixed formats:
FS_PLUGINS: | verifactu 464 https://custom-site.com/my-plugin.zip
| Plugin Name | ID | Description | URL |
|---|---|---|---|
verifactu |
448 | VERI*FACTU compliance for Spain | Info |
multiempresa |
464 | Multi-company management | Info |
webportal |
460 | Customer web portal | Info |
openpaypf |
400 | OpenPay payment gateway | Info |
notificaciones |
356 | Notifications system | Info |
pagosonline |
391 | Online payments | Info |
services:
facturascripts:
image: erseco/alpine-facturascripts
environment:
# ... other variables ...
FS_PLUGINS: "verifactu multiempresa"- On first container startup (when no
.plugins_installedmarker exists) - Each plugin is downloaded from the specified source
- Plugins are installed using FacturaScripts'
Plugins::add()API - Plugins are automatically enabled using
Plugins::enable() - A marker file is created to prevent reinstallation on subsequent startups
- If any plugin fails to install, the container startup will fail to ensure consistency
- Plugins are only installed once on first startup
- To reinstall plugins, remove the
.plugins_installedmarker file from the Plugins directory - If a plugin installation fails, the entire container startup is aborted
- Custom plugin URLs must point directly to a valid ZIP file
- All plugins must contain a valid
facturascripts.inifile
Plugin not found:
# Check available plugins at facturascripts.com
# Or use the download ID or full URL instead of the nameInstallation failed:
# Check container logs
docker compose logs facturascripts
# Verify the plugin ZIP is valid
# Ensure database is accessible
# Check FS_DISABLE_ADD_PLUGINS is not set to trueReinstall plugins:
# Remove marker file
docker compose exec facturascripts rm /var/www/html/Plugins/.plugins_installed
# Restart container
docker compose restart facturascriptsFacturaScripts requires a cron process for certain tasks in some plugins. While not strictly mandatory, it is highly recommended to run scheduled tasks.
The container automatically runs a cron daemon that executes FacturaScripts scheduled tasks. By default, it runs every hour, but you can customize the interval using the CRON_INTERVAL environment variable.
The cron executes the following command:
php index.php -cronYou can customize the cron schedule using the CRON_INTERVAL environment variable with any valid cron expression:
environment:
# Run every 60 seconds (every minute)
CRON_INTERVAL: "* * * * *"environment:
# Run every 5 minutes
CRON_INTERVAL: "*/5 * * * *"environment:
# Run every hour at minute 0 (default)
CRON_INTERVAL: "0 * * * *"Common Cron Expressions:
* * * * *- Every minute (recommended for Verifactu)*/5 * * * *- Every 5 minutes*/15 * * * *- Every 15 minutes0 * * * *- Every hour (default)0 */2 * * *- Every 2 hours0 0 * * *- Daily at midnight
If you need to disable the cron daemon (for testing or specific deployments), set the RUN_CRON_TASKS environment variable to false:
environment:
RUN_CRON_TASKS: falseYou can manually trigger the cron tasks at any time:
From the browser:
http://localhost:8080/cron
From the command line:
docker compose exec facturascripts php84 /var/www/html/index.php -cronCheck if the cron daemon is running:
docker compose exec facturascripts ps aux | grep crondView cron logs:
docker compose logs facturascripts | grep cronFacturaScripts plugins can also be installed manually through the web interface:
- Log in to your FacturaScripts installation
- Go to Admin Panel > Plugins
- Search for the plugin you want to install
- Click "Install"
Alternatively, you can manually place plugin files in the /var/www/html/Plugins directory:
# Copy plugin to the container
docker cp my-plugin.zip facturascripts:/var/www/html/Plugins/
# Extract if needed
docker compose exec facturascripts unzip /var/www/html/Plugins/my-plugin.zip -d /var/www/html/Plugins/The container uses volumes to persist important data:
/var/www/html/volume/MyFiles- Uploaded files, documents, and configuration/var/www/html/volume/Plugins- Installed plugins
Important: Make sure to properly back up these volumes to prevent data loss.
Example backup command:
# Backup MyFiles
docker run --rm -v alpine-facturascripts_facturascripts_volume:/data -v $(pwd):/backup alpine tar czf /backup/facturascripts-backup-$(date +%Y%m%d).tar.gz -C /data .
# Backup database
docker compose exec mariadb mysqldump -u facturascripts -pfacturascripts facturascripts > facturascripts-db-$(date +%Y%m%d).sqlFacturaScripts supports the following databases:
- MySQL / MariaDB (recommended)
- PostgreSQL
To use PostgreSQL, change the DB_TYPE environment variable to postgresql and adjust the connection parameters accordingly.
- Change default passwords: Always change the default database passwords in production environments.
- Use HTTPS: For production deployments, use a reverse proxy (like nginx or Traefik) with SSL/TLS certificates.
- Regular backups: Implement a backup strategy for both the database and the volume data.
- Keep updated: Regularly update to the latest FacturaScripts version to get security patches.
docker compose exec --user root facturascripts sh -c "apk update && apk add nano"docker compose logs -f facturascriptsIf you need to manually rebuild FacturaScripts dynamic classes:
# Access the rebuild endpoint
curl "http://localhost:8080/deploy?action=rebuild&token=$(docker compose exec facturascripts grep -o 'token=[^"]*' /var/www/html/Core/Controller/Deploy.php | cut -d'=' -f2 | head -1)"docker compose exec facturascripts rm -rf /var/www/html/MyFiles/Cache/*# MySQL/MariaDB
docker compose exec mariadb mysql -u facturascripts -pfacturascripts facturascripts
# PostgreSQL
docker compose exec postgres psql -U facturascripts -d facturascriptsMake sure the database container is running and the environment variables are correctly set. You can check the logs:
docker compose logs facturascripts
docker compose logs mariadbThe container runs as the nobody user for security. If you encounter permission issues, ensure the volumes have the correct permissions.
If the database is already configured, FacturaScripts will skip the installation wizard. Check if there's an existing config.php file in the root directory (/var/www/html/config.php).
This error occurs when FacturaScripts needs to rebuild its dynamic classes. Access the rebuild endpoint:
curl "http://localhost:8080/deploy?action=rebuild"Or restart the container:
docker compose restart facturascriptsContributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Based on erseco/alpine-php-webserver
- FacturaScripts by FacturaScripts
FacturaScripts docker image based on Alpine Linux.
Docker Hub: hub.docker.com/r/erseco/alpine-facturascripts
dockernginxlightweightalpineaccountingbillingfacturascriptserpphp8
- π README
- π License: MIT
- π Issues
- π Pull Requests