-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
109 lines (80 loc) · 3.66 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
FROM node:12 as frontend-build
COPY ./src/iws/frontend/ /usr/src
WORKDIR /usr/src
RUN npm install
RUN npm run build
FROM node:16 as floodmaps-ext-build
COPY ./src/iws/mapstore_extensions/geotour/ /usr/src
WORKDIR /usr/src
RUN npm install
RUN npm run build
FROM python:3.9.14-buster
LABEL GeoNode development team
RUN mkdir -p /usr/src/iws
# Enable postgresql-client-13
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list
RUN echo "deb http://deb.debian.org/debian/ stable main contrib non-free" | tee /etc/apt/sources.list.d/debian.list
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
# To get GDAL 3.2.1 to fix this issue https://github.com/OSGeo/gdal/issues/1692
# TODO: The following line should be removed if base image upgraded to Bullseye
RUN echo "deb http://deb.debian.org/debian/ bullseye main contrib non-free" | tee /etc/apt/sources.list.d/debian.list
# This section is borrowed from the official Django image but adds GDAL and others
RUN apt-get update -y && apt-get upgrade -y
# Prepraing dependencies
RUN apt-get install -y \
gdal-bin libgdal-dev libpq-dev libxml2-dev \
libxml2 libxslt1-dev zlib1g-dev libjpeg-dev \
libmemcached-dev libldap2-dev libsasl2-dev libffi-dev
RUN apt-get install -y --no-install-recommends \
gcc zip gettext geoip-bin cron \
postgresql-client-13 \
sqlite3 spatialite-bin libsqlite3-mod-spatialite \
python3-dev python3-gdal python3-psycopg2 python3-ldap \
python3-pip python3-pil python3-lxml python3-pylibmc \
uwsgi uwsgi-plugin-python3 \
firefox-esr \
proj-bin
RUN apt-get install -y devscripts build-essential debhelper pkg-kde-tools sharutils
# RUN git clone https://salsa.debian.org/debian-gis-team/proj.git /tmp/proj
# RUN cd /tmp/proj && debuild -i -us -uc -b && dpkg -i ../*.deb
# Install pip packages
RUN pip install pip --upgrade \
&& pip install pygdal==$(gdal-config --version).* \
flower==0.9.4
# Activate "memcached"
RUN apt install -y memcached
RUN pip install pylibmc \
&& pip install sherlock
# add bower and grunt command
COPY src /usr/src/iws/
WORKDIR /usr/src/iws
COPY src/monitoring-cron /etc/cron.d/monitoring-cron
RUN chmod 0644 /etc/cron.d/monitoring-cron
RUN crontab /etc/cron.d/monitoring-cron
RUN touch /var/log/cron.log
RUN service cron start
COPY src/wait-for-databases.sh /usr/bin/wait-for-databases
RUN chmod +x /usr/bin/wait-for-databases
RUN chmod +x /usr/src/iws/tasks.py \
&& chmod +x /usr/src/iws/entrypoint.sh
COPY src/celery.sh /usr/bin/celery-commands
RUN chmod +x /usr/bin/celery-commands
COPY src/celery-cmd /usr/bin/celery-cmd
RUN chmod +x /usr/bin/celery-cmd
# # Install "geonode-contribs" apps
# RUN cd /usr/src; git clone https://github.com/GeoNode/geonode-contribs.git -b master
# # Install logstash and centralized dashboard dependencies
# RUN cd /usr/src/geonode-contribs/geonode-logstash; pip install --upgrade -e . \
# cd /usr/src/geonode-contribs/ldap; pip install --upgrade -e .
RUN pip install --upgrade --no-cache-dir --src /usr/src -r requirements.txt
RUN pip install -r app_requirements.txt
RUN pip install --upgrade -e . && numpy==1.23
COPY --from=frontend-build /usr/src/static /usr/src/iws/iws/frontend/static
COPY --from=frontend-build /usr/src/webpack-stats.json /usr/src/iws/iws/frontend/webpack-stats.json
COPY --from=floodmaps-ext-build /usr/src/dist /usr/src/iws/iws/static/mapstore/extensions/GeoTour
# Cleanup apt update lists
RUN rm -rf /var/lib/apt/lists/*
# Export ports
EXPOSE 8000
# We provide no command or entrypoint as this image can be used to serve the django project or run celery tasks
# ENTRYPOINT /usr/src/iws/entrypoint.sh