Containers & Cloud
Docker & Cloud PaaS Deployment
Deploy Lacelium as lightweight, reproducible container images on Docker, Kubernetes, or modern cloud platforms such as Fly.io, Railway, Render, and Google Cloud Run.
Production Dockerfile
A multi-stage, high-performance Dockerfile based on official PHP 8.2 Alpine with OPcache and Nginx enabled:
FROM php:8.2-fpm-alpine AS base
# Install system dependencies & PHP extensions
RUN apk add --no-cache nginx supervisor curl git libpng-dev libzip-dev \
&& docker-php-ext-install pdo pdo_mysql gd zip opcache
# Install Composer
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
WORKDIR /var/www/lacelium
# Copy composer files and install production dependencies
COPY composer.json composer.lock ./
RUN composer install --no-dev --optimize-autoloader --no-interaction --no-scripts
# Copy application source code
COPY . .
# Set permissions for storage
RUN chown -R www-data:www-data storage storage/cache \
&& chmod -R 775 storage storage/cache
# Copy Nginx and Supervisor configs
COPY docker/nginx.conf /etc/nginx/nginx.conf
COPY docker/supervisord.conf /etc/supervisord.conf
EXPOSE 80 8080
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
Docker Compose (Local & Staging)
Run Lacelium with MySQL and Redis using docker-compose.yml:
version: '3.8'
services:
app:
build: .
ports:
- "80:80"
- "8080:8080"
environment:
APP_ENV: production
APP_DEBUG: "false"
DB_HOST: mysql
DB_DATABASE: lacelium
DB_USERNAME: lacelium
DB_PASSWORD: secret_password
volumes:
- storage_data:/var/www/lacelium/storage
depends_on:
- mysql
mysql:
image: mysql:8.0
environment:
MYSQL_DATABASE: lacelium
MYSQL_USER: lacelium
MYSQL_PASSWORD: secret_password
MYSQL_ROOT_PASSWORD: root_secret_password
volumes:
- db_data:/var/lib/mysql
volumes:
storage_data:
db_data:
Cloud PaaS Platforms (Fly.io / Railway / Render)
When deploying to ephemeral cloud container runtimes, configure persistent storage volumes to ensure uploaded assets and session SQLite databases persist across deployments:
Fly.io Volume Configuration (fly.toml)
[mounts]
source = "lacelium_storage"
destination = "/var/www/lacelium/storage"
[http_service]
internal_port = 80
force_https = true
auto_stop_machines = false
auto_start_machines = true
Next Steps
- Review comprehensive deployment strategies in Deployment Hub.
- Configure systemd services and Nginx reverse proxy in Linux VPS Guide.
- Fine-tune application secrets and database credentials in Configuration.