forked from opendatateam/udata
/
Dockerfile
80 lines (60 loc) · 2.26 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
##########################################
# Dockerfile for udata
# Use multistage build to separate a builder image with webpack, etc.
# from a lighter definitive runner image
##########################################
FROM udata/system AS builder
WORKDIR /udata
RUN apt-get update && apt-get install -y gnupg gcc
# Install nodejs and npm dependencies for webpack build
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt-get install -y nodejs
COPY package.json .
RUN npm install
# Install pip dependencies
RUN pip install Cython wheel virtualenv
RUN virtualenv venv
RUN /udata/venv/bin/pip install --upgrade pip
COPY requirements ./requirements
RUN /udata/venv/bin/pip install -r ./requirements/develop.pip
# Install udata itself from sources in context
COPY udata ./udata
COPY js ./js
COPY less ./less
COPY *.py *.cfg *.js *.yml *.md LICENSE MANIFEST.in ./
# Build
RUN /udata/venv/bin/python setup.py compile_catalog
RUN npm run assets:build
RUN npm run widgets:build
RUN npm run oembed:build
RUN /udata/venv/bin/pip install .
# Second part is mostly a clone of the Dockerfile in the separate project docker-udata
FROM udata/system
MAINTAINER Open Data Team
# Install some production system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
# uWSGI rooting features
libpcre3-dev \
# Clean up
&& apt-get autoremove\
&& apt-get clean\
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
WORKDIR /udata
# Fetch full python env from builder image
RUN pip install Cython wheel virtualenv
COPY --from=builder /udata/venv /udata/venv
# Install dependencies for running udata and some known plugins
COPY docker/requirements.pip ./requirements/docker.pip
RUN /udata/venv/bin/pip install -r ./requirements/docker.pip
RUN mkdir -p /udata/fs /src
COPY docker/udata.cfg docker/entrypoint.sh /udata/
COPY docker/uwsgi/*.ini /udata/uwsgi/
VOLUME /udata/fs
ENV UDATA_SETTINGS /udata/udata.cfg
EXPOSE 7000 7001
# TODO: a better health check ?
# Calling localhost fails with a 404 when SERVER_NAME is defined in the config,
# and defining SERVER_NAME is required to be able to use 'udata search index'
# HEALTHCHECK --interval=5s --timeout=3s CMD curl --fail http://localhost:7000/ || exit 1
ENTRYPOINT ["/udata/entrypoint.sh"]
CMD ["uwsgi"]