This repository was archived by the owner on Jan 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (40 loc) · 1.31 KB
/
Dockerfile
File metadata and controls
51 lines (40 loc) · 1.31 KB
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
FROM ubuntu:trusty
MAINTAINER ODL DevOps <mitx-devops@mit.edu>
# Add package files
WORKDIR /tmp
# Install base packages
COPY apt.txt /tmp/apt.txt
RUN apt-get update &&\
apt-get install -y $(grep -vE "^\s*#" apt.txt | tr "\n" " ") &&\
ln -s /usr/bin/nodejs /usr/bin/node
# Install pip
RUN curl --silent --location https://bootstrap.pypa.io/get-pip.py > get-pip.py &&\
python3 get-pip.py &&\
python get-pip.py
# Add non-root user.
RUN adduser --disabled-password --gecos "" mitodl
# Install project packages
# Python 2
COPY requirements.txt /tmp/requirements.txt
COPY test_requirements.txt /tmp/test_requirements.txt
COPY doc_requirements.txt /tmp/doc_requirements.txt
RUN pip install -r requirements.txt &&\
pip install -r test_requirements.txt &&\
pip install -r doc_requirements.txt
# Python 3
RUN pip3 install -r requirements.txt &&\
pip3 install -r test_requirements.txt
# Add project
COPY . /src
WORKDIR /src
RUN chown -R mitodl:mitodl /src
# Gather static
RUN ./manage.py collectstatic --noinput
RUN apt-get clean && apt-get purge
USER mitodl
# Set pip cache folder, as it is breaking pip when it is on a shared volume
ENV XDG_CACHE_HOME /tmp/.cache
# Set and expose port for uwsgi config
EXPOSE 8070
ENV PORT 8070
CMD if [ -n "$WORKER" ]; then celery -A lore worker; else uwsgi uwsgi.ini; fi