Skip to content

Commit 06cb362

Browse files
committed
Add cron job to automatically update libc-database
1 parent 3a46ef1 commit 06cb362

File tree

4 files changed

+29
-1
lines changed

4 files changed

+29
-1
lines changed

Dockerfile

+13
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,18 @@ FROM tiangolo/uwsgi-nginx-flask:flask-python3.5
33
# Remove sample application included in the base image.
44
RUN rm /app/main.py /app/uwsgi.ini
55

6+
# Install cron
7+
RUN apt-get update \
8+
&& apt-get install -y cron \
9+
&& rm -rf /var/lib/apt/lists/*
10+
11+
# Install cron job
12+
COPY crontab /etc/cron.d/libc-update
13+
RUN chmod 0644 /etc/cron.d/libc-update
14+
RUN touch /var/log/libcdb.log
15+
16+
# Register cron to supervisor
17+
COPY cron.conf /etc/supervisor/conf.d/cron.conf
18+
619
COPY app /app
720
COPY libc-database /libc-database

cron.conf

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[program:cron]
2+
command = /usr/sbin/cron -f
3+
user = root
4+
autostart = true
5+
6+
[program:cron_output]
7+
command = tail -f /var/log/libcdb.log
8+
autostart = true
9+
stdout_logfile=/dev/stdout
10+
stdout_logfile_maxbytes=0
11+
stderr_logfile=/dev/stderr
12+
stderr_logfile_maxbytes=0

crontab

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Update libc-database every day
2+
# min hour day mon week user cmd
3+
0 12 * * * root cd /libc-database && (./get; echo -n "### Update done "; date) >> /var/log/libcdb.log 2>&1

run.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
git submodule update --init
22
sudo docker build -t libc .
3-
sudo docker run --rm -p31337:80 -it libc
3+
sudo docker run --name ll --rm -p31337:80 -it libc

0 commit comments

Comments
 (0)