forked from zenodo/zenodo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
80 lines (65 loc) · 2.24 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#
# Zenodo development docker build
#
FROM python:3.5
MAINTAINER Zenodo <info@zenodo.org>
ARG TERM=linux
ARG DEBIAN_FRONTEND=noninteractive
# Install dependencies
RUN apt-get update \
&& apt-get -qy upgrade --fix-missing --no-install-recommends \
&& apt-get -qy install --fix-missing --no-install-recommends \
apt-utils curl libcairo2-dev fonts-dejavu libfreetype6-dev \
# Node.js
&& curl -sL https://deb.nodesource.com/setup_6.x | bash - \
&& apt-get -qy install --fix-missing --no-install-recommends \
nodejs \
# Slim down image
&& apt-get clean autoclean \
&& apt-get autoremove -y \
&& rm -rf /var/lib/{apt,dpkg}/ \
&& rm -rf /usr/share/man/* /usr/share/groff/* /usr/share/info/* \
&& find /usr/share/doc -depth -type f ! -name copyright -delete
# Include /usr/local/bin in path.
RUN echo "export PATH=${PATH}:/usr/local/bin >> ~/.bashrc"
# Basic Python tools
RUN pip install --upgrade pip setuptools ipython wheel uwsgi pipdeptree
# NPM
COPY ./scripts/setup-npm.sh /tmp
RUN /tmp/setup-npm.sh
#
# Zenodo specific
#
# Create instance/static folder
ENV APP_INSTANCE_PATH /usr/local/var/instance
RUN mkdir -p ${APP_INSTANCE_PATH}
WORKDIR /tmp
# Copy and install requirements. Faster build utilizing the Docker cache.
COPY requirements*.txt /tmp/
RUN mkdir -p /usr/local/src/ \
&& mkdir -p /code/zenodo \
&& pip install -r requirements.txt --src /usr/local/src
# Copy source code
COPY . /code/zenodo
WORKDIR /code/zenodo
# Install Zenodo
RUN pip install -e .[postgresql,elasticsearch2,all] \
&& python -O -m compileall .
# Install npm dependencies and build assets.
RUN zenodo npm --pinned-file /code/zenodo/package.pinned.json \
&& cd ${APP_INSTANCE_PATH}/static \
&& npm install \
&& cd /code/zenodo \
&& zenodo collect -v \
&& zenodo assets build
RUN adduser --uid 1000 --disabled-password --gecos '' zenodo \
&& chown -R zenodo:zenodo /code ${APP_INSTANCE_PATH}
RUN mkdir -p /usr/local/var/data && \
chown zenodo:zenodo /usr/local/var/data -R && \
mkdir -p /var/log/zenodo && \
chown zenodo:zenodo /var/log/zenodo -R
COPY ./docker/docker-entrypoint.sh /
USER zenodo
VOLUME ["/code/zenodo"]
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["zenodo", "run", "-h", "0.0.0.0"]