forked from CERNDocumentServer/cds-videos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
85 lines (68 loc) · 2.12 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
81
82
83
84
85
# CDS production docker build
FROM python:3.5-slim
MAINTAINER CDS <[email protected]>
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 \
curl \
git \
gcc \
# Postgres
libpq-dev \
# python-pillow
libjpeg-dev \
libffi-dev \
libfreetype6-dev \
libmsgpack-dev \
# CairoSVG
libcairo2-dev \
libssl-dev \
libxml2-dev \
libxslt-dev \
imagemagick \
# Node.js
&& curl -sL https://deb.nodesource.com/setup_iojs_2.x | bash - \
&& apt-get -qy install --fix-missing --no-install-recommends \
iojs \
&& 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
# Basic Python tools
RUN pip install --upgrade pip setuptools ipython gunicorn
# NPM
COPY ./scripts/setup-npm.sh /tmp
RUN /tmp/setup-npm.sh
# CDS specific
# Set copy for static files, linking is a nightmare
ENV APP_COLLECT_STORAGE=flask_collect.storage.file
# Pre-install modules for caching
COPY ./docker/docker-entrypoint.sh /
# Create instance/static folder
ENV APP_INSTANCE_PATH /usr/local/var/instance
RUN mkdir -p ${APP_INSTANCE_PATH}
WORKDIR /code/cds
# Copy and install requirements. Faster build utilizing the Docker cache.
COPY requirements*.txt /code/cds/
RUN pip install -r requirements.devel.txt --src /code/
# Copy source code
COPY . /code/cds/
# Install CDS
RUN pip install -e .[all]
# Install bower dependencies and build assets.
RUN cds npm \
&& cd ${APP_INSTANCE_PATH}/static \
&& npm install \
&& cd /code/cds \
&& cds collect -v \
&& cds assets build
RUN adduser --uid 1000 --disabled-password --gecos '' cds \
&& chown -R cds:cds /code ${APP_INSTANCE_PATH}
USER cds
VOLUME ["/code/cds"]
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["cds", "run", "-h", "0.0.0.0"]