Skip to content

Commit

Permalink
Fix Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
aknuds1 committed Jan 4, 2016
1 parent 7b03ae6 commit da873f6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
13 changes: 8 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
FROM debian
MAINTAINER "MuzHack" <[email protected]>

RUN apt-get update && apt-get install -y cron python3 rethinkdb \
&& pip3 install virtualenv
RUN apt-get update && apt-get install -y cron python3 python3-pip lsb-release wget
RUN echo "deb http://download.rethinkdb.com/apt `lsb_release -cs` main" | tee /etc/apt/sources.list.d/rethinkdb.list
RUN wget -qO- https://download.rethinkdb.com/apt/pubkey.gpg | apt-key add -
RUN apt-get update && apt-get install -y rethinkdb
RUN apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

WORKDIR /app
COPY ./crontab /etc/cron.d/
COPY ./requirements.txt /app
COPY ./requirements.txt /app/
RUN mkdir -p /app/rethinkdb
COPY ./rethinkdb/backup.py /app/rethinkdb/

RUN virtualenv /env && /env/bin/pip3 install -r requirements.txt
RUN pip3 install -r requirements.txt
RUN rm -rf requirements.txt

CMD /env/bin/python3 cron.py
CMD python3 cron.py
3 changes: 1 addition & 2 deletions cron.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os


crontab_filename = '/etc/cron.d/cron-python'
crontab_filename = '/etc/cron.d/crontab'
with open(crontab_filename, 'rb') as f:
crontab = f.readlines()
for k in [k for k in os.environ if k.startswith('CRONVAR_')]:
Expand All @@ -12,4 +12,3 @@
with open(crontab_filename, 'wb') as f:
f.write('\n'.join(crontab))
subprocess.check_call(['crond', '-L', '15',])

2 changes: 1 addition & 1 deletion crontab
Original file line number Diff line number Diff line change
@@ -1 +1 @@
30 18 * * * /env/bin/python3 /app/rethinkdb/backup.py --s3-bucket $S3_BUCKET --remove
30 18 * * * python3 /app/rethinkdb/backup.py --s3-bucket $S3_BUCKET --remove

0 comments on commit da873f6

Please sign in to comment.