FROM cloudron/base:5.0.0 # Install dependencies RUN apt-get update && \ apt-get install -y \ php8.3 \ php8.3-cli \ php8.3-fpm \ php8.3-mysql \ php8.3-redis \ php8.3-curl \ php8.3-gd \ php8.3-mbstring \ php8.3-xml \ php8.3-zip \ php8.3-bcmath \ php8.3-intl \ php8.3-gnupg \ php8.3-gmp \ php8.3-imagick \ php8.3-mailparse \ composer \ nginx \ supervisor \ postfix \ rspamd \ redis-tools \ mysql-client \ gnupg \ git \ curl \ nodejs \ npm && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* # Set working directory WORKDIR /app/code # Clone AnonAddy repository RUN git clone --branch v1.3.5 https://github.com/anonaddy/anonaddy.git /app/code && \ chown -R cloudron:cloudron /app/code # Install PHP dependencies RUN cd /app/code && \ composer install --no-dev --optimize-autoloader --no-interaction && \ chown -R cloudron:cloudron /app/code/vendor # Install Node dependencies and build assets RUN cd /app/code && \ echo "APP_URL=http://localhost" > .env && \ npm install && \ npm run production && \ rm -f .env && \ rm -rf node_modules && \ chown -R cloudron:cloudron /app/code/public # Remove storage directory - will be symlinked to /app/data/storage in start.sh RUN rm -rf /app/code/storage # Copy configuration files COPY nginx.conf /etc/nginx/sites-available/default COPY supervisor.conf /etc/supervisor/conf.d/anonaddy.conf COPY start.sh /app/code/start.sh COPY postfix-main.cf /tmp/postfix-main.cf COPY postfix-master.cf /tmp/postfix-master.cf COPY laravel-paths.php /app/code/laravel-paths.php # Patch bootstrap/app.php to use custom storage paths RUN sed -i '/\$app = new Illuminate/a require_once __DIR__.'\''/laravel-paths.php'\'';' /app/code/bootstrap/app.php # Initialize data directory structure RUN mkdir -p /tmp/data && \ mkdir -p /tmp/data/storage && \ mkdir -p /tmp/data/storage/logs && \ mkdir -p /tmp/data/storage/framework && \ mkdir -p /tmp/data/storage/framework/cache && \ mkdir -p /tmp/data/storage/framework/sessions && \ mkdir -p /tmp/data/storage/framework/views && \ mkdir -p /tmp/data/storage/app && \ mkdir -p /tmp/data/storage/app/public && \ mkdir -p /tmp/data/dkim && \ mkdir -p /tmp/data/postfix && \ mkdir -p /tmp/data/rspamd && \ chown -R cloudron:cloudron /tmp/data # Set permissions RUN chmod +x /app/code/start.sh && \ chown -R cloudron:cloudron /app/code && \ chmod -R 755 /app/code/bootstrap/cache # Create volume mount points for writable directories VOLUME ["/app/data", "/run", "/tmp"] # Configure PHP-FPM to run as cloudron user RUN sed -i 's/user = www-data/user = cloudron/g' /etc/php/8.3/fpm/pool.d/www.conf && \ sed -i 's/group = www-data/group = cloudron/g' /etc/php/8.3/fpm/pool.d/www.conf && \ sed -i 's/listen.owner = www-data/listen.owner = cloudron/g' /etc/php/8.3/fpm/pool.d/www.conf && \ sed -i 's/listen.group = www-data/listen.group = cloudron/g' /etc/php/8.3/fpm/pool.d/www.conf # Configure PHP to log to stderr RUN sed -i 's/;catch_workers_output = yes/catch_workers_output = yes/g' /etc/php/8.3/fpm/pool.d/www.conf && \ sed -i 's/;php_admin_flag[log_errors] = on/php_admin_flag[log_errors] = on/g' /etc/php/8.3/fpm/pool.d/www.conf EXPOSE 8000 25 CMD ["/app/code/start.sh"]