Skip to content
Open
Show file tree
Hide file tree
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
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
SRC?=$(shell dirname `pwd`)

build:
docker-compose build
up:
docker-compose up
migrate:
docker-compose run web python manage.py migrate


13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: '2'
services:
db:
image: postgres
web:
build: ./docker/
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
ports:
- "8000:8000"
depends_on:
- db
33 changes: 33 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM python:2-onbuild

LABEL maintainer="Cristian David Chushig Muzo <cdavid.chushig@gmail.com>"

USER root

RUN apt-get -qq update && DEBIAN_FRONTEND=noninteractive apt-get -y \
install sudo xvfb \
git wget python-virtualenv python-numpy python-scipy netpbm \
python-pyqt5 ghostscript libffi-dev libjpeg-turbo-progs \
python-dev python-setuptools \
python3-dev cmake \
libtiff5-dev libjpeg-dev zlib1g-dev \
libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev \
python-tk python3-tk \
libharfbuzz-dev libfribidi-dev && apt-get clean

RUN git clone https://github.com/python-pillow/Pillow.git && cd Pillow/depends \
&& ./install_openjpeg.sh && ./install_raqm.sh

RUN mkdir /code/
WORKDIR /code/
ADD requirements.txt /code/
RUN pip install -r requirements.txt

# Latest version of Hairball framework
RUN git clone https://github.com/jemole/hairball.git /code/hairball \
&& cd /code/hairball && pip install .

ADD . /code/

# COPY ./docker-entrypoint.sh /
# ENTRYPOINT ["/docker-entrypoint.sh"]
26 changes: 26 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Using Dr. Scratch via Docker
This directory contains `Dockerfile` to make it easy to build and running drScratch environment via [Docker](https://www.docker.com/).

## Installing Docker
General instructions to install Docker can be followed in the next links:
[Install Docker](https://docs.docker.com/install/).
[Install Docker Compose](https://docs.docker.com/compose/install/).

## Running the container

We use `Makefile` to simplify docker-compose commands.

Build Docker images of db and web application.
```bash
$ make build
```

Run the containers of db and web application.
```bash
$ make up
```

Run Django task to migrate tables of db.
```bash
$ make migrate
```
4 changes: 4 additions & 0 deletions docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

python manage.py migrate
python manage.py collectstatic --noinput
12 changes: 12 additions & 0 deletions docker/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
coloredlogs==9.0
construct==2.0.6
Django==1.11.11
djangorestframework==3.7.7
humanfriendly==4.8
kurt==2.0.7
Markdown==2.6.10
monotonic==1.4
olefile==0.44
Pillow==4.3.0
pytz==2018.3
psycopg2==2.7.4