###############################################################################
# EspoCRM - Development Server for Extensions
# Based on official image, overlays custom code on each deploy
###############################################################################

FROM espocrm/espocrm:latest

# Fix redirect loop: tell Apache it's behind HTTPS proxy (Traefik)
RUN echo 'SetEnv HTTPS on' > /etc/apache2/conf-available/force-https.conf && \
    a2enconf force-https

# 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

EXPOSE 80
