Files
email_reports/Dockerfile
Frank John Begornia d0d82aa8e1 Unified email reports
2026-01-02 01:19:07 +08:00

40 lines
1.1 KiB
Docker

FROM php:7.4-cli-alpine
# Install dependencies
RUN apk add --no-cache \
dcron \
mysql-client \
&& docker-php-ext-install pdo pdo_mysql
# Set timezone
RUN apk add --no-cache tzdata && \
cp /usr/share/zoneinfo/America/Chicago /etc/localtime && \
echo "America/Chicago" > /etc/timezone && \
apk del tzdata
# Create app directory
WORKDIR /app
# Copy email reports scripts
COPY . /app/
# Create reports directories
RUN mkdir -p /app/daily_order_reports_crew /app/daily_order_reports_merchbay && \
chmod 755 /app/daily_order_reports_crew /app/daily_order_reports_merchbay
# Create crontab with both reports
RUN echo "55 23 * * * BRAND=crew php /app/send_report.php >> /var/log/cron.log 2>&1" > /etc/crontabs/root && \
echo "56 23 * * * BRAND=merchbay php /app/send_report.php >> /var/log/cron.log 2>&1" >> /etc/crontabs/root && \
chmod 0644 /etc/crontabs/root
# Create log file
RUN touch /var/log/cron.log && \
chmod 666 /var/log/cron.log
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD ps aux | grep -v grep | grep -q crond || exit 1
# Start cron in foreground
CMD crond -f -l 2