Skip to content

Commit

Permalink
Add Docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanv committed Jul 14, 2016
1 parent 5386a4d commit 2a35d34
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM ubuntu:16.04

RUN apt-get update && \
apt-get -y upgrade && \
apt-get install -y python3 python3-venv libpq-dev libhdf5-serial-dev \
libnetcdf-dev supervisor libpython3-dev supervisor \
nginx npm nodejs

RUN python3 -m venv /cesium_env

ADD . /cesium
WORKDIR /cesium
RUN bash -c "source /cesium_env/bin/activate && \
pip install --upgrade pip && \
pip install --upgrade pip && \
export PIP_FIND_LINKS=http://wheels.scikit-image.org && \
make paths && \
make dependencies && \
cp docker/cesium_docker.yaml . && \
cp docker/* . && \
ln -s /usr/bin/nodejs /usr/bin/node"

EXPOSE 5000

CMD bash -c "source /cesium_env/bin/activate && \
supervisord -c conf/supervisord.conf"

42 changes: 42 additions & 0 deletions docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

version: '2'

services:
web:
image: cesium/web
ports:
- "80:5000"
links:
- db
- celery
volumes:
- .:/home/cesium_app
depends_on:
- db
- rabbit
- celery

db:
image: cesium/postgres
volumes:
- ./_postgres_data:/var/lib/postgresql/data/
environment:
- POSTGRES_USER=cesium
- POSTGRES_PASSWORD=
- POSTGRES_DB=cesium
- PGDATA=/var/lib/postgresql/data/pgdata

rabbit:
image: rabbitmq:3
ports:
- "5672:5672"

celery:
image: celery
depends_on:
- rabbit
links:
- rabbit
environment:
- CELERY_BROKER=amqp://guest:guest@rabbit:5672/
- CELERY_BROKER_URL=amqp://guest:guest@rabbit:5672/
10 changes: 10 additions & 0 deletions docker/cesium_docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
database:
database: cesium
host: db
port: 5432
user: cesium
password:

server:
url: http://localhost:5000

3 changes: 3 additions & 0 deletions docker/postgres/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM postgres:9.5
ADD ./init-user-db.sh /docker-entrypoint-initdb.d/init-user-db.sh

13 changes: 13 additions & 0 deletions docker/postgres/init-user-db.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
set -e

psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL
CREATE USER cesium;
CREATE DATABASE cesium;
GRANT ALL PRIVILEGES ON DATABASE cesium TO cesium;
EOSQL

cd /cesium
source /cesium_env/bin/activate && \
PYTHONPATH=. python -c "from cesium_app.models import create_tables as c; c()"

0 comments on commit 2a35d34

Please sign in to comment.