Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docker support #1187

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 37 additions & 0 deletions Dockerfile
@@ -0,0 +1,37 @@
FROM ubuntu:14.04

RUN apt-get update \
&& apt-get install -y software-properties-common \
&& add-apt-repository ppa:deadsnakes/ppa

RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y \
build-essential \
ca-certificates \
gcc \
git \
libpq-dev \
make \
mercurial \
pkg-config \
python3.4 \
python3.4-dev \
ssh \
libxml2-dev \
libxslt1-dev \
ruby \
&& apt-get autoremove \
&& apt-get clean

ADD https://raw.githubusercontent.com/pypa/pip/5d927de5cdc7c05b1afbdd78ae0d1b127c04d9d0/contrib/get-pip.py /root/get-pip.py
RUN python3.4 /root/get-pip.py
RUN pip3.4 install -U "setuptools==18.4"
RUN pip3.4 install -U "pip==7.1.2"
RUN pip3.4 install -U "virtualenv==13.1.2"

COPY ./*requirements.txt /app/
RUN pip3.4 install -r /app/dev-requirements.txt

COPY . /app
WORKDIR /app
26 changes: 26 additions & 0 deletions docker-compose.yml
@@ -0,0 +1,26 @@
version: '2'

services:
postgres:
image: postgres
ports:
- "5432:5432"
environment:
- DEBUG=false
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=1234
- POSTGRES_DB=pythondotorg

django:
restart: always
build: .
ports:
- "8000:8000"
depends_on:
- postgres
links:
- postgres:db

command: ["/bin/bash","docker-start.sh"]
environment:
- DATABASE_URL=postgres://postgres:1234@db:5432/pythondotorg
5 changes: 5 additions & 0 deletions docker-start.sh
@@ -0,0 +1,5 @@
sleep 5
python3.4 manage.py migrate
gem install bundler && bundle install
python3.4 manage.py create_initial_data <<< "y"
python3.4 manage.py runserver 0.0.0.0:8000