statistics docker setup, cleanup on sync script, added supervisord

This commit is contained in:
2025-03-30 14:36:20 +03:00
parent b0c09ade50
commit 6557a951ba
4 changed files with 54 additions and 56 deletions
+25 -14
View File
@@ -1,23 +1,34 @@
FROM php:cli
# Install required dependencies
RUN apt-get update && apt-get install -y cron unzip curl && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y \
cron \
unzip \
curl \
libpng-dev \
libjpeg-dev \
supervisor \
&& pecl install redis \
&& docker-php-ext-install pdo pdo_mysql gd \
&& docker-php-ext-enable redis \
&& rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-install pdo pdo_mysql
RUN curl -sS https://getcomposer.org/installer | \
php -- --install-dir=/usr/local/bin --filename=composer
RUN apt-get update && apt-get install -y libpng-dev libjpeg-dev \
&& pecl install redis && docker-php-ext-enable redis
# Copy the cron job script
WORKDIR /app
COPY fetch_and_send.php /app/fetch_and_send.php
# install composer dependencies
COPY . .
RUN composer install
COPY crontab /etc/cron.d/crontab
RUN chmod +x /app/fetch_and_send.php
# Give execution rights on the cron job file
RUN chmod 0644 /etc/cron.d/crontab && crontab /etc/cron.d/crontab
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
RUN touch /var/log/cron.log && touch /app/statistics.log
RUN chmod 0644 /etc/cron.d/crontab \
&& crontab /etc/cron.d/crontab \
&& touch /var/log/cron.log /app/sync.log \
&& chmod +x /app/sync.php
# Start cron in the foreground
CMD ["cron", "-f"]
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]