Skip to content

Commit

Permalink
Feature: Docker compose improvements (#765)
Browse files Browse the repository at this point in the history
* Add .venv to ignored paths

* Match Docker setup to the new code
  • Loading branch information
uda authored and danielhers committed Oct 6, 2017
1 parent 329d334 commit 09d063f
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 28 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
@@ -0,0 +1,3 @@
.dockerignore
Dockerfile
docker-compose-*
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -44,6 +44,7 @@ nosetests.xml
.DS_Store

venv
.venv

# data files
/static/data/lms
Expand Down
43 changes: 20 additions & 23 deletions Dockerfile
@@ -1,32 +1,29 @@
FROM partlab/ubuntu-java

# Use bash for environment setup
RUN ln -snf /bin/bash /bin/sh
FROM ubuntu:xenial

# Install system tools
RUN apt-get -y update && apt-get install -y --no-install-recommends -qq build-essential \
git \
python-pip \
python-dev \
python-tk \
libpq-dev \
vim \
sqlite3 \
&& apt-get clean

# Create required aliases and env variables
RUN echo "export DATABASE_URL=sqlite:////anyway/local.db" >> ~/.bashrc
RUN apt-get -y update && \
apt-get install -y --no-install-recommends -qq \
build-essential \
python-pip \
python-dev \
python-tk \
libpq-dev \
sqlite3 \
openjdk-9-jre \
&& apt-get clean

WORKDIR /anyway
EXPOSE 5000

ADD requirements.txt /anyway
RUN pip install -U setuptools
# First copy only the requirement.txt, so changes in other files won't trigger
# a full pip reinstall
COPY requirements.txt /anyway
RUN pip install -U setuptools wheel
RUN pip install -r requirements.txt

ADD . /anyway
COPY . /anyway

RUN export "DATABASE_URL=sqlite:////anyway/local.db" && python models.py && python process.py
VOLUME ["/anyway/static"]
EXPOSE 5000

#docker docker build -t hasdna/anyway .
#docker run -it -p 80:5000 --name anyway hasdna/anyway /bin/bash -c 'export DATABASE_URL=sqlite:////anyway/local.db && python main.py --open'
ENTRYPOINT ["/anyway/docker-entrypoint.sh"]
CMD ["python", "main.py", "testserver", "--open"]
20 changes: 20 additions & 0 deletions docker-compose-pgsql.yml
@@ -0,0 +1,20 @@
version: '2'

services:
anyway:
build: .
image: hasadna/anyway:latest
ports:
- "8080:5000"
environment:
- DATABASE_URL=postgresql://anyway:anyway@db/anyway
volumes:
- ./static:/anyway/static
restart: always
db:
image: postgres:alpine
environment:
- POSTGRES_PASSWORD=anyway
- POSTGRES_USER=anyway
- POSTGRES_DB=anyway
restart: always
13 changes: 13 additions & 0 deletions docker-compose-sqlite.yml
@@ -0,0 +1,13 @@
version: '2'

services:
anyway:
build: .
image: hasadna/anyway:latest
ports:
- "8080:5000"
environment:
- DATABASE_URL=sqlite:////anyway/local.db
volumes:
- ./static:/anyway/static
restart: always
5 changes: 0 additions & 5 deletions docker-compose.yml

This file was deleted.

9 changes: 9 additions & 0 deletions docker-entrypoint.sh
@@ -0,0 +1,9 @@
#!/bin/bash

cd /anyway

alembic upgrade head
python main.py process cbs
python main.py process united --light

exec "$@"

0 comments on commit 09d063f

Please sign in to comment.