Some checks failed
Deploy Production Email Reports (Unified) / deploy (push) Failing after 18s
44 lines
1.3 KiB
Docker
44 lines
1.3 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
|
|
|
|
# Copy entrypoint script
|
|
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
|
RUN chmod +x /docker-entrypoint.sh
|
|
|
|
# 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
|
|
|
|
# Use entrypoint script
|
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|