-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile-r-service
78 lines (64 loc) · 2.16 KB
/
Dockerfile-r-service
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
FROM tworavens/psi-r-service-base:latest
MAINTAINER Raman Prasad (raman_prasad@harvard.edu)
LABEL organization="PSI" \
2ra.vn.version="0.0.6-beta" \
2ra.vn.release-date="2018-01-11" \
description="Image for the PSI R service, which runs on flask."
# -------------------------------------
# Install R openssl library
# -------------------------------------
#RUN R -e 'install.packages("openssl", repos="http://cran.rstudio.org")'
RUN R -e 'library(devtools);install_github("privacytoolsproject/PSI-Library")'
# -------------------------------------
# Install Tex Base
# -------------------------------------
RUN apt-get update && \
apt-get install -y pandoc \
texlive-full
RUN tlmgr init-usertree
# -------------------------------------
# Copy the repo over
# - future: ignore the tworavens django dirs
# and assets, be more selective
# -------------------------------------
RUN mkdir -p /var/webapps/PSI && \
mkdir -p /var/webapps/PSI/assets && \
mkdir -p /var/webapps/PSI/data && \
mkdir -p /psi_volume
# Copy over the repository
COPY R /var/webapps/PSI/R
COPY ./LICENSE /var/webapps/PSI
COPY ./README.md /var/webapps/PSI
COPY ./data/ /var/webapps/PSI/data
# -------------------------------------
# Create a volume for outside info
# -------------------------------------
VOLUME /psi_volume
# -------------------------------------
# Expose port for the web (flask)
# -------------------------------------
EXPOSE 8000
WORKDIR /var/webapps/PSI/R
# -------------------------------------
# Copy over the requirements and run them
# -------------------------------------
COPY ./requirements/ ./requirements
RUN pip3 install --upgrade pip && \
pip3 install --no-cache-dir -r requirements/R-service.txt
# -------------------------------------
# Run flask
# -------------------------------------
CMD cd R; python3 runner.py
# -----------------------------------------
# -- Dev notes --
#
# build local:
# >docker build -t rook1 -f ./Dockerfile-r-service .
#
# shell access:
# >docker run -ti -p 8000:8000 rook1 /usr/bin/bash
#
# run app
# >docker run -p 8000:8000 rook1
# go to: http://0.0.0.0:8000/subsetapp
# -----------------------------------------