summaryrefslogtreecommitdiff
path: root/docker/config/info.md
blob: 3ca1c810608177414026ca07eedc3b873e048e6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
## About cron jobs

(on docker containers)

Dockerfile #1

    RUN apt-get update && apt-get install cron -y 
    RUN crontab /
    crontab -l | { cat; echo "10 * * * * /usr/local/bin/php /var/www/core/cli/cache-categories.php"; } | crontab -
    CMD cron



---


Dockerfile #2

    RUN apt-get update && \
        apt-get -y install tzdata cron

    RUN cp /usr/share/zoneinfo/Europe/Rome /etc/localtime && \
        echo "Europe/Rome" > /etc/timezone

    #RUN apt-get -y remove tzdata
    RUN rm -rf /var/cache/apk/*

    # Copy cron file to the cron.d directory
    COPY cron /etc/cron.d/cron

    # Give execution rights on the cron job
    RUN chmod 0644 /etc/cron.d/cron

    # Apply cron job
    RUN crontab /etc/cron.d/cron

    # Create the log file to be able to run tail
    RUN mkdir -p /var/log/cron

    # Add a command to base-image entrypont scritp
    RUN sed -i 's/^exec /service cron start\n\nexec /' /usr/local/bin/apache2-foreground


---

handle cron status

    service cron status
    service cron stop
    service cron start



---


docker folder: organizing configuration files

    docker
         |-- bin: docker-ettrypoint.sh, optimize.sh
         |
         `-- config: composer*.json opcache.ini php-overides.ini cron-jobs


---


check:
* http://www.idein.it/joomla/14-docker-php-apache-with-crontab