A lightweight FacturaScripts Docker image built on Alpine Linux
10K+
A lightweight FacturaScripts Docker image built on Alpine Linux. (~30MB)
Repository: https://github.com/erseco/alpine-facturascripts
FS_PLUGINSamd64, arm/v6, arm/v7, arm64, ppc64le, s390xnobody) for improved securitydocker logs -f <container>)FacturaScripts is a free and open-source accounting and billing software for small and medium-sized businesses. It offers features like:
Learn more at https://facturascripts.com
FS_INITIAL_USER and FS_INITIAL_PASS with secure values.docker compose up
Log in using the credentials defined by environment variables.
services:
facturascripts:
image: ghcr.io/erseco/alpine-facturascripts
# rest of your config
In 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 sh
Here 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: null
With 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 up
Once 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:
docker compose uphttp://localhost:8080 and log in with your credentialsThe container automatically creates:
config.php with all necessary settings.htaccess file for URL rewritingMyFiles, Plugins, Dinamic)If you don't provide FS_INITIAL_USER and FS_INITIAL_PASS, the standard installation wizard will appear on first access:
http://localhost:8080You 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 version
Available versions can be found at https://facturascripts.com/descargas
After changing the version, rebuild the image:
docker compose build facturascripts
You 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 here
This 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"
.plugins_installed marker exists)Plugins::add() APIPlugins::enable().plugins_installed marker file from the Plugins directoryfacturascripts.ini filePlugin not found:
# Check available plugins at facturascripts.com
# Or use the download ID or full URL instead of the name
Installation 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 true
Reinstall plugins:
# Remove marker file
docker compose exec facturascripts rm /var/www/html/Plugins/.plugins_installed
# Restart container
docker compose restart facturascripts
FacturaScripts 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 -cron
You 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 midnightIf 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: false
You 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 -cron
Check if the cron daemon is running:
docker compose exec facturascripts ps aux | grep crond
View cron logs:
docker compose logs facturascripts | grep cron
FacturaScripts plugins can also be installed manually through the web interface:
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 pluginsImportant: 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).sql
FacturaScripts supports the following databases:
To use PostgreSQL, change the DB_TYPE environment variable to postgresql and adjust the connection parameters accordingly.
docker compose exec --user root facturascripts sh -c "apk update && apk add nano"
docker compose logs -f facturascripts
If 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 facturascripts
Make 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 mariadb
The 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 facturascripts
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
FacturaScripts docker image based on Alpine Linux.
Docker Hub: hub.docker.com/r/erseco/alpine-facturascripts
dockernginxlightweightalpineaccountingbillingfacturascriptserpphp8Content type
Image
Digest
sha256:1ed5c8c26…
Size
36.1 MB
Last updated
29 days ago
docker pull erseco/alpine-facturascripts