Created
March 26, 2020 22:18
-
-
Save princefishthrower/d4ba12a7beadd105173499664083a0f0 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 ubuntu:16.04 | |
# Ubuntu 16.04 ships with Python 3.5 as default. We should install and use python 3.7 to use the newest Django version (3.0.4 as of March 2020) | |
# We also need the python3.7-dev package in order for mod_wsgi-standalone to read the headers which are specific to 3.7.7 | |
RUN apt install -y software-properties-common | |
RUN add-apt-repository -y ppa:deadsnakes/ppa | |
RUN apt update | |
RUN apt install -y python3.7 | |
RUN apt install -y python3.7-dev | |
# Update the simlink of our 'python3' command | |
rm /usr/bin/python3 | |
ln -s python3.7 /usr/bin/python3 | |
RUN apt install -y python3-pip | |
RUN pip3 install virtualenv | |
# Install apache2 and apache2-dev as they are dependencies for mod_wsgi-standalone | |
RUN apt install -y apache2 | |
RUN apt install -y apache2-dev | |
# Install git and clone the repository of your choice | |
RUN apt install -y git | |
RUN git clone <<YOUR_REPOSITORY_URL_HERE>> | |
git checkout <<RELEVANT_BRANCH_HERE>> | |
cd <<YOUR_REPOSITORY_NAME>> | |
virtualenv .env && source .env/bin/activate && pip3 install -r requirements.txt | |
# NOTE that in a multiple user setup, the command 'pip3 install mod_wsgi-standalone' would have to be run by the root user! | |
# It is also important to issue this install WITHIN the virtualenv | |
RUN pip3 install mod_wsgi-standalone | |
# Finally run the server (this assumes you are running something like an apache server proxied to localhost:8080 | |
mod_wsgi-express start-server <<YOUR_DJGANGO_PROJECT_FOLDER>>/wsgi.py --log-to-terminal --host 127.0.0.1 --port 8080 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment