Skip to content

Commit 6d5d496

Browse files
committed
improve Docker env
1 parent 361515c commit 6d5d496

File tree

6 files changed

+47
-31
lines changed

6 files changed

+47
-31
lines changed

Dockerfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
FROM python:3.6
2+
3+
# update ca-certificates
4+
RUN apt-get update -y && apt-get install ca-certificates -y
5+
6+
7+
ADD requirements.txt requirements.txt
8+
ADD app /app
9+
RUN chmod 777 /app/main/static/tmp/
10+
11+
RUN pip install --upgrade pip
12+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
13+
RUN pip install gunicorn
14+
15+
# register photonai_neuro since non privileged user cannot write to PHOTONAI registry
16+
RUN python -c "import photonai_neuro"
17+
18+
RUN useradd --create-home flaskserver
19+
USER flaskserver
20+
21+
ENV STATIC_URL /main/static
22+
# Absolute path in where the static files wil be
23+
ENV STATIC_PATH /app/main/static
24+
25+
WORKDIR /
26+
ENV PYTHONPATH = /
27+
28+
EXPOSE 8080
29+
30+
CMD ["gunicorn", "--conf", "/app/gunicorn_conf.py", "--bind", "0.0.0.0:8080", "app.main"]

app/gunicorn_conf.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Gunicorn config variables
2+
loglevel = "info"
3+
errorlog = "-" # stderr
4+
#accesslog = "-" # stdout
5+
accesslog = None
6+
worker_tmp_dir = "/dev/shm"
7+
graceful_timeout = 120
8+
timeout = 120
9+
keepalive = 5
10+
threads = 3

app/main/wizard_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class PHOTONWebConfig(object):
44
SECRET_KEY = 'do-i-really-need-this'
55
# THE MONGODB THAT THE WIZARD ELEMENTS ARE STORED IN, NOT PHOTONAI RESULTS
66
# specify your mongodb instance here
7-
MONGODB_CS = 'mongodb://localhost:27017'
7+
MONGODB_CS = 'mongodb://mongo:27017'
88
LOGIN_DISABLED = True
99

1010
# specify a folder where the PHOTONAI script can be written to

docker-compose.yml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
version: '2'
22
services:
3-
mongodb_container:
3+
mongo:
44
image: mongo:latest
5-
# environment:
6-
# MONGO_INITDB_ROOT_USERNAME: root
7-
# MONGO_INITDB_ROOT_PASSWORD: rootpassword
85
ports:
9-
- 0.0.0.0:27017:27017
6+
- 127.0.0.1:27017:27017
107
volumes:
118
- mongodb_data_container:/data/db
129

@@ -16,15 +13,11 @@ services:
1613
restart: always
1714
build:
1815
context: .
19-
dockerfile: dockerfile_web
20-
network_mode: host
16+
dockerfile: Dockerfile
2117
ports:
22-
- "0.0.0.0:8004:80"
23-
volumes:
24-
- ./app:/app
25-
- ./photon_wizard:/spm-data/Scratch/photon_wizard/
18+
- "127.0.0.1:8081:8080"
2619
depends_on:
27-
- mongodb_container
20+
- mongo
2821

2922
volumes:
3023
mongodb_data_container:

dockerfile_web

Lines changed: 0 additions & 16 deletions
This file was deleted.

requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ numpy
1717
scikit-learn
1818
matplotlib
1919
requests
20-
git+https://github.com/wwu-mmll/photonai@develop
20+
photonai
2121
git+https://github.com/wwu-mmll/photonai_neuro
2222
openpyxl
2323
plotly
24-

0 commit comments

Comments
 (0)