Last active
December 11, 2017 02:25
-
-
Save thebopshoobop/76973c3ac6d7f5864c51e1ab00671e3a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:3.6 | |
# create working directory | |
RUN mkdir -p /usr/src/app | |
RUN mkdir -p /usr/src/py | |
# install virtualenv globally | |
RUN pip install virtualenv | |
# create app user | |
RUN groupadd -r -g 2000 app | |
RUN useradd -r -u 2000 -g 2000 -s /usr/bin/nologin app | |
RUN chown -R 2000:2000 /usr/src | |
USER app | |
# switch to working directory | |
WORKDIR /usr/src/app | |
# add requirements (to leverage Docker cache) | |
ADD ./requirements.txt /usr/src/app/requirements.txt | |
# install requirements | |
RUN virtualenv /usr/src/py | |
RUN /usr/src/py/bin/pip install --no-cache-dir -r requirements.txt | |
# add app | |
ADD . /usr/src/app | |
# run server | |
CMD /usr/src/py/bin/python manage.py run -h 0.0.0.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment