forked from Stemweb/Stemweb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
64 lines (50 loc) · 2.94 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# install everything based on image "python:3.7"
FROM python:3.7
ENV DEBIAN_FRONTEND=noninteractive
#========== create the technical user "stemweb" with sudo-right =======
RUN adduser stemweb --gecos ""
RUN usermod -aG sudo stemweb
WORKDIR /home/stemweb
#======================== install tools ================================
RUN apt-get update && apt-get -y install graphviz libgraphviz-dev pkg-config wget libffi-dev libssl-dev r-base-core curl vim tree python3-dev sed gawk sudo gcc
# with debugging tools:
#RUN apt-get update && apt-get -y install graphviz libgraphviz-dev pkg-config wget libffi-dev libssl-dev r-base-core curl vim tree python3-dev sed gawk sudo gdb gcc gdbserver
RUN pip install -U setuptools
RUN pip install pyopenssl ndg-httpsclient pyasn1 rpy2 mysqlclient ptvsd pygraphviz pymysql djangorestframework
#===================== install requirements ============================
COPY Stemweb/requirements/requirements.txt requirements.txt
RUN pip install -r requirements.txt
#=========== copy configured stemweb repository from host server =======
COPY manage.py .
COPY docker-entrypoint.sh .
COPY wait-for-it.sh .
COPY Stemweb Stemweb
#===== compile & build the c-extension "binarysankoff" for python =====
WORKDIR /home/stemweb/Stemweb/algorithms/rhm
#RUN gcc -I/usr/local/include/python3.8/ -I/usr/include/python3.8 -lpython3.8 -I/usr/local/include -L/usr/local/lib -fPIC -g -Wall -c binarysankoff_linux.c
#RUN gcc -I/usr/local/include/python3.7/ -I/usr/include/python3.7 -lpython3.7 -I/usr/local/include -L/usr/local/lib -fPIC -g -Wall -c binarysankoff_linux.c
#RUN gcc -shared -fPIC -Wall -I/usr/local/include -L/usr/local/lib binarysankoff_linux.o -o binarysankoff.so -lz
RUN python setup_c_binarysankoff.py build
RUN python setup_c_binarysankoff.py install
#===== compile & build the c-extension "adding" for python ============
#== "adding" is a toy app used to test implementation of c-extension ==
WORKDIR /home/stemweb/Stemweb/algorithms
#RUN gcc -I/usr/local/include/python3.7/ -I/usr/include/python3.7 -lpython3.7 -I/usr/local/include -L/usr/local/lib -fPIC -g -Wall -c addingmodule.c
#RUN gcc -shared -fPIC -Wall -I/usr/local/include -L/usr/local/lib addingmodule.o -o adding.so
RUN python setup_c_addingmodule.py build
# special build for debugging:
#RUN python setup_c_addingmodule.py build_ext --inplace -j4 --with-debugging-symbols
RUN python setup_c_addingmodule.py install
#============ make the log directory and set permissions ===============
WORKDIR /home/stemweb
RUN mkdir Stemweb/logs && chown -R stemweb:stemweb .
#============ for reporting errors in c-code ===========================
#ENV PYTHONFAULTHANDLER=1
#====================== start the server ===============================
# EXPOSE port 3000 for debugging access from outside of the docker container,
# EXPOSE port 8000 for the web site
# EXPOSE port 51000 as fixed http-request outbound src-port
#EXPOSE 3000 8000 51000
EXPOSE 8000
USER stemweb
ENTRYPOINT ["./docker-entrypoint.sh"]