-
Notifications
You must be signed in to change notification settings - Fork 90
/
Dockerfile
58 lines (51 loc) · 1.68 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
FROM alpine:latest
# Install Python
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \
&& apk add --update \
bash \
build-base \
git \
libffi-dev \
musl \
nodejs \
nodejs-npm \
postgresql-dev \
py2-pip \
python \
python-dev \
redis \
runit \
&& pip install --upgrade pip \
&& npm install -g bower less \
&& rm /var/cache/apk/*
# Make some useful symlinks that are expected to exist
RUN cd /usr/bin \
&& ln -sf easy_install-2.7 easy_install \
&& ln -sf python2.7 python \
&& ln -sf python2.7-config python-config \
&& ln -sf pip2.7 pip
# Copy and install our requirements first, so they can be cached
COPY ./requirements/prod.txt /tmp/requirements.txt
RUN pip install -r /tmp/requirements.txt \
&& pip install 'gunicorn==19.6.0'
# Add our application to the container
COPY . /src/
# Create service directories to allow running services, along with the Doorman
# user/group.
RUN rm -rf /etc/service \
&& mv /src/docker/service /etc/ \
&& mv /src/docker/redis.conf /etc/ \
&& if [ ! -f /src/settings.cfg ]; then \
mv /src/docker/default-settings.cfg /src/settings.cfg; \
fi \
&& addgroup doorman \
&& adduser -G doorman -D doorman
# Install vendor libraries, pre-build static assets, and create default log
# file directory.
RUN cd /src/ \
&& bower install --allow-root \
&& python manage.py assets build \
&& mkdir /var/log/doorman/ \
&& chown doorman:doorman -R . \
&& chown doorman:doorman /var/log/doorman/
CMD ["runsvdir", "/etc/service"]