forked from channeng/celery-scheduler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
42 lines (34 loc) · 1.39 KB
/
Dockerfile
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
# Pull base image.
FROM ubuntu:14.04
# Install Supervisor.
RUN \
mkdir /var/log/celery && \
mkdir /var/log/redis && \
mkdir /home/ubuntu && \
apt-get update && \
apt-get install -y supervisor python-dev python-pip wget vim git && \
rm -rf /var/lib/apt/lists/* && \
sed -i 's/^\(\[supervisord\]\)$/\1\nnodaemon=true/' /etc/supervisor/supervisord.conf
# needs to be set else Celery gives an error (because docker runs commands inside container as root)
# https://github.com/pm990320/docker-flask-celery/blob/master/Dockerfile
ENV C_FORCE_ROOT=1
# expose port 80 of the container (HTTP port, change to 443 for HTTPS)
EXPOSE 80
# Create virtualenv.
RUN \
pip install --upgrade pip && \
pip install --upgrade virtualenv && \
virtualenv -p /usr/bin/python2.7 /home/ubuntu/.virtualenvs/celery_env
# Setup for ssh onto github, clone and define working directory
ADD https://api.github.com/repos/cheempz/celery-scheduler/git/refs/heads/master repo_version.json
RUN git clone https://github.com/cheempz/celery-scheduler.git /home/ubuntu/celery-scheduler
WORKDIR /home/ubuntu/celery-scheduler
# Install app requirements
RUN \
. /home/ubuntu/.virtualenvs/celery_env/bin/activate && \
pip install -r requirements.txt && \
. scripts/install_redis.sh
# Copy supervisor configs
RUN \
cp configs/supervisord.conf /etc/supervisor/supervisord.conf && \
cp configs/conf.d/*.conf /etc/supervisor/conf.d/