Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 11 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ ENV DJANGO_PRODUCTION=true
ENV DEBIAN_FRONTEND noninteractive

# Enable MySQL root user creation without interactive input
RUN echo 'mysql-server mysql-server/root_password password devrootpass' | debconf-set-selections
RUN echo 'mysql-server mysql-server/root_password_again password devrootpass' | debconf-set-selections
RUN echo 'mysql-server mysql-server/root_password password devrootpass' | debconf-set-selections && \
echo 'mysql-server mysql-server/root_password_again password devrootpass' | debconf-set-selections

# Install packages
RUN apt-get update && apt-get install -y \
Expand All @@ -21,23 +21,19 @@ RUN apt-get update && apt-get install -y \
python-mysqldb \
python-setuptools \
supervisor \
vim
RUN easy_install pip
vim && \
easy_install pip

# Handle urllib3 InsecurePlatformWarning
RUN apt-get install -y libffi-dev libssl-dev libpython2.7-dev
RUN pip install urllib3[security] requests[security] ndg-httpsclient pyasn1
RUN apt-get install -y libffi-dev libssl-dev libpython2.7-dev && \
pip install urllib3[security] requests[security] ndg-httpsclient pyasn1

# Configure Django project
ADD . /code
RUN mkdir /djangomedia
RUN mkdir /static
RUN mkdir /logs
RUN mkdir /logs/nginx
RUN mkdir /logs/gunicorn
RUN mkdir /djangomedia /static /logs /logs/nginx /logs/gunicorn
WORKDIR /code
RUN pip install -r requirements.txt
RUN chmod ug+x /code/initialize.sh
RUN pip install -r requirements.txt && \
chmod ug+x /code/initialize.sh

# Expose ports
# 80 = Nginx
Expand All @@ -46,8 +42,8 @@ RUN chmod ug+x /code/initialize.sh
EXPOSE 80 8000 3306

# Configure Nginx
RUN ln -s /code/nginx.conf /etc/nginx/sites-enabled/django_docker.conf
RUN rm /etc/nginx/sites-enabled/default
RUN ln -s /code/nginx.conf /etc/nginx/sites-enabled/django_docker.conf && \
rm /etc/nginx/sites-enabled/default

# Run Supervisor (i.e., start MySQL, Nginx, and Gunicorn)
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
Expand Down