Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Docker compose improvements (#765)
* Add .venv to ignored paths * Match Docker setup to the new code
- Loading branch information
1 parent
329d334
commit 09d063f
Showing
7 changed files
with
66 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.dockerignore | ||
Dockerfile | ||
docker-compose-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,7 @@ nosetests.xml | |
.DS_Store | ||
|
||
venv | ||
.venv | ||
|
||
# data files | ||
/static/data/lms | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
cd /anyway | ||
|
||
alembic upgrade head | ||
python main.py process cbs | ||
python main.py process united --light | ||
|
||
exec "$@" |