47 lines
1.3 KiB
Docker
47 lines
1.3 KiB
Docker
###############################################################################
|
|
# EspoCRM - Development Server for Extensions
|
|
# Based on official image, overlays custom code on each deploy
|
|
###############################################################################
|
|
|
|
FROM espocrm/espocrm:latest
|
|
|
|
# Copy custom extensions and modifications
|
|
COPY custom/ /var/www/html/custom/
|
|
|
|
# Ensure correct permissions
|
|
RUN chown -R www-data:www-data /var/www/html/custom
|
|
|
|
# Post-deploy: clear cache and rebuild on startup
|
|
COPY --chmod=755 <<'EOF' /usr/local/bin/post-deploy.sh
|
|
#!/bin/bash
|
|
set -e
|
|
|
|
# Wait for the original entrypoint to finish setup
|
|
sleep 5
|
|
|
|
# Clear cache so EspoCRM picks up new/changed extensions
|
|
if [ -d "/var/www/html/data/cache" ]; then
|
|
rm -rf /var/www/html/data/cache/*
|
|
echo "Cache cleared."
|
|
fi
|
|
|
|
# Run rebuild if config exists (means EspoCRM is installed)
|
|
if [ -f "/var/www/html/data/config.php" ]; then
|
|
cd /var/www/html
|
|
php rebuild.php
|
|
echo "Rebuild complete."
|
|
fi
|
|
EOF
|
|
|
|
# Wrap the original entrypoint to run post-deploy after startup
|
|
COPY --chmod=755 <<'EOF' /usr/local/bin/dev-entrypoint.sh
|
|
#!/bin/bash
|
|
# Run post-deploy in background after container starts
|
|
(post-deploy.sh &)
|
|
# Execute original entrypoint
|
|
exec docker-entrypoint.sh apache2-foreground
|
|
EOF
|
|
|
|
EXPOSE 80
|
|
ENTRYPOINT ["dev-entrypoint.sh"]
|