This repository has been archived by the owner on Jun 17, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
dockerfile-prod
94 lines (79 loc) · 2.93 KB
/
dockerfile-prod
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
FROM ubuntu:trusty
EXPOSE 4000
ENV ES_VERSION 1.7.1
ENV MYSQL_VERSION 5.6
ENV NODE_MODULES /usr/local/lib/node_modules/
ENV ES_BIN /elasticsearch-$ES_VERSION/bin
RUN apt-get -y update && apt-get install -y \
redis-server \
git \
wget \
curl \
unzip \
nodejs \
npm \
default-jre \
libmysqlclient-dev \
libxml2-dev \
libxslt-dev \
libjpeg-dev \
libfreetype6-dev \
libtiff-dev \
libffi-dev \
software-properties-common \
python-dev \
python-pip
# Download ElasticSearch
RUN wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-"${ES_VERSION}".zip && \
unzip elasticsearch-"${ES_VERSION}".zip && \
rm elasticsearch-"${ES_VERSION}".zip
# For the new Nodejs to work
RUN ln -s /usr/bin/nodejs /usr/bin/node
# Configure and install MySQL
RUN { \
echo mysql-community-server mysql-community-server/data-dir select ''; \
echo mysql-community-server mysql-community-server/root-pass password ''; \
echo mysql-community-server mysql-community-server/re-root-pass password ''; \
echo mysql-community-server mysql-community-server/remove-test-db select false; \
} | debconf-set-selections
RUN apt-get install -y mysql-server-"${MYSQL_VERSION}"
# NPM dependencies (installed in /usr/local/bin)
RUN npm update && npm install -g bower less clean-css uglify-js requirejs
# Invenio
RUN mkdir /src && \
cd /src/ && \
git clone --branch=master https://github.com/HEPData/invenio.git && \
cd invenio && \
pip install -e .
# HEPData
RUN cd /src/ && \
git clone --branch=master https://github.com/HEPData/hepdata.git && \
cd hepdata && \
pip install -e .
# Install Bower dependencies
RUN cd /src/hepdata && \
inveniomanage bower -i bower-base.json > bower.json && \
bower install --force-latest --allow-root
# Configuration
RUN inveniomanage config create secret-key && \
inveniomanage config set CFG_EMAIL_BACKEND flask.ext.email.backends.console.Mail && \
inveniomanage config set CFG_BIBSCHED_PROCESS_USER `whoami` && \
inveniomanage config set CFG_TMPDIR /tmp && \
inveniomanage config set CFG_SITE_URL http://0.0.0.0:4000 && \
inveniomanage config set CFG_SITE_SECURE_URL https://0.0.0.0:4000
# assets build?
# Set NPM deps binaries
RUN inveniomanage config set LESS_BIN `find $NODE_MODULES -iname lessc | head -1` && \
inveniomanage config set CLEANCSS_BIN `find $NODE_MODULES -iname cleancss | head -1` && \
inveniomanage config set REQUIREJS_BIN `find $NODE_MODULES -iname r.js | head -1` && \
inveniomanage config set UGLIFYJS_BIN `find $NODE_MODULES -iname uglifyjs | head -1`
RUN inveniomanage collect > /dev/null
# Database
RUN service mysql start && \
service redis-server start && \
(./elasticsearch-"${ES_VERSION}"/bin/elasticsearch &) && \
sleep 7 && \
inveniomanage database init --user=root --password= --yes-i-know && \
inveniomanage database create --quiet && \
inveniomanage hepdata_records populate > /dev/null 2>&1
CMD cd /src/hepdata && honcho start