Skip to content

Instantly share code, notes, and snippets.

@pwilkins
Created May 28, 2015 15:13
Show Gist options
  • Save pwilkins/655a736d3c0b94063fb3 to your computer and use it in GitHub Desktop.
Save pwilkins/655a736d3c0b94063fb3 to your computer and use it in GitHub Desktop.
FROM ubuntu:trusty
MAINTAINER ODL DevOps <mitx-devops@mit.edu>
# Add package files
ADD requirements.txt /tmp/requirements.txt
ADD test_requirements.txt /tmp/test_requirements.txt
ADD apt.txt /tmp/apt.txt
WORKDIR /tmp
# Install base packages
RUN apt-get update
RUN apt-get install -y $(grep -vE "^\s*#" apt.txt | tr "\n" " ")
RUN pip install pip --upgrade
# Install project packages
RUN pip install -r requirements.txt
RUN pip install -r test_requirements.txt
RUN pip install -r doc_requirements.txt
RUN pip3 install -r requirements.txt
RUN pip3 install -r test_requirements.txt
RUN pip3 install -r doc_requirements.txt
# Add, and run as, non-root user.
RUN adduser --disabled-password --gecos "" mitodl
# Add project
ADD . /src
WORKDIR /src
RUN chown -R mitodl:mitodl /src
# Install node packages and add to PATH
RUN ln -s /usr/bin/nodejs /usr/bin/node
RUN npm install -g --prefix /node
ENV PATH /node/lib/node_modules/lore/node_modules/.bin:$PATH
# Set pip cache folder, as it is breaking pip when it is on a shared volume
ENV XDG_CACHE_HOME /tmp/.cache
EXPOSE 8070
USER mitodl
CMD uwsgi uwsgi.ini
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment