Skip to content

Commit

Permalink
Add docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
pablogsal committed Nov 5, 2017
1 parent 7b76446 commit 2d0ba41
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
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

0 comments on commit 2d0ba41

Please sign in to comment.