-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
143 lines (131 loc) · 5.92 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
FROM ubuntu:focal-20220113
# to build:
# docker build --rm -t ades:latest .
# to run:
# docker run --rm -ti -p 80:80 ades:latest
# procadesdev:latest
ENV DEBIAN_FRONTEND noninteractive
########################################
### DEV TOOLS
RUN apt-get update -qqy --no-install-recommends \
# Various cli tools
&& apt-get install -qqy --no-install-recommends wget mlocate tree \
# C++ and CMAKE
gcc mono-mcs cmake \
build-essential libcgicc-dev gdb \
#Install Docker CE CLI
curl apt-transport-https ca-certificates gnupg2 lsb-release \
&& curl -fsSL https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/gpg | apt-key add - 2>/dev/null \
&& echo "deb [arch=amd64] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list \
&& apt-get update -qqy --no-install-recommends \
&& apt-get install -qqy --no-install-recommends docker-ce-cli && \
apt-get clean -qqy
ARG PY_VER=3.8
# Miniconda
RUN wget -nv \
https://repo.anaconda.com/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh \
&& bash Miniconda3-py39_4.10.3-Linux-x86_64.sh -b -p /usr/miniconda3 \
&& rm -f Miniconda3-py39_4.10.3-Linux-x86_64.sh
ENV PATH="/usr/miniconda3/envs/ades-dev/bin:/usr/miniconda3/bin:${PATH}"
COPY assets/ades-dev_env.yaml /tmp/ades-dev_env.yaml
RUN conda install mamba -n base -c conda-forge && \
mamba env create --file /tmp/ades-dev_env.yaml &&\
rm /tmp/ades-dev_env.yaml
########################################
# ZOO_Prerequisites
RUN apt-get install -qqy --no-install-recommends software-properties-common && \
add-apt-repository ppa:ubuntugis/ubuntugis-unstable && \
add-apt-repository ppa:ubuntugis/ppa && \
apt-get update -qqy --no-install-recommends && \
apt-get install -qqy --no-install-recommends software-properties-common\
git\
wget\
vim\
flex\
bison\
libfcgi-dev\
libxml2\
libxml2-dev\
curl\
libssl-dev\
autoconf\
apache2\
subversion\
libmozjs185-dev\
python3-dev\
python3-setuptools\
build-essential\
libxslt1-dev\
uuid-dev\
libjson-c-dev\
libmapserver-dev\
libgdal-dev\
libaprutil1-dev \
librabbitmq-dev\
libapache2-mod-fcgid\
wget \
pkg-config\
# if you remove --with-db-backend from the configure command, uncomment the following line
#RUN ln -s /usr/lib/x86_64-linux-gnu/libfcgi.a /usr/lib/
&& a2enmod actions fcgid alias proxy_fcgi \
&& /etc/init.d/apache2 restart \
&& rm -rf /var/lib/apt/lists/*
########################################
# ZOO_KERNEL
ARG ZOO_PRJ_GIT_BRANCH='feature/deploy-undeploy-ogcapi-route'
RUN cd /opt && git clone --depth 1 https://github.com/terradue/ZOO-Project.git -b $ZOO_PRJ_GIT_BRANCH
#COPY ZPGIT /opt/ZOO-Project
WORKDIR /opt/ZOO-Project
RUN make -C ./thirds/cgic206 libcgic.a
RUN cd ./zoo-project/zoo-kernel \
&& autoconf \
&& ./configure --with-python=/usr/miniconda3/envs/ades-dev --with-pyvers=$PY_VER --with-js=/usr --with-mapserver=/usr --with-ms-version=7 --with-json=/usr --prefix=/usr --with-metadb=yes --with-db-backend --with-rabbitmq=yes \
&& sed -i "s/-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H/-DPROJ_VERSION_MAJOR=8/g" ./ZOOMakefile.opts \
&& make -j4\
&& make install \
&& cp main.cfg /usr/lib/cgi-bin \
&& cp zoo_loader.cgi /usr/lib/cgi-bin \
&& cp zoo_loader_fpm /usr/lib/cgi-bin \
&& cp oas.cfg /usr/lib/cgi-bin \
\
# Install Basic Authentication sample
&& cd ../zoo-services/utils/security/basicAuth \
&& make \
&& cp cgi-env/* /usr/lib/cgi-bin \
\
&& sed -i "s%http://www.zoo-project.org/zoo/%http://127.0.0.1%g" /usr/lib/cgi-bin/main.cfg \
&& sed -i "s%../tmpPathRelativeToServerAdress/%http://localhost/temp/%g" /usr/lib/cgi-bin/main.cfg \
&& echo "\n[env]\nPYTHONPATH=/usr/miniconda3/envs/ades-dev/lib/python${PY_VER}/site-packages"\
>> /usr/lib/cgi-bin/main.cfg \
&& a2enmod cgi rewrite \
&& sed "s:AllowOverride None:AllowOverride All:g" -i /etc/apache2/apache2.conf \
&& cd /opt/ZOO-Project \
&& cp ./docker/.htaccess /var/www/html/.htaccess \
&& cp -r zoo-project/zoo-services/utils/open-api/templates/index.html /var/www/index.html \
&& cp -r zoo-project/zoo-services/utils/open-api/static /var/www/html/ \
&& cp zoo-project/zoo-services/utils/open-api/cgi-env/* /usr/lib/cgi-bin/ \
&& cd thirds/zcfg2sql && \
grep CALLBACK ../../zoo-project/zoo-kernel/ZOOMakefile.opts && \
grep JSON ../../zoo-project/zoo-kernel/ZOOMakefile.opts && \
make && \
cp zcfg2sql /usr/bin && \
ln -s /tmp/ /var/www/html/temp && \
mkdir /var/www/html/examples/ && \
curl -o /var/www/html/examples/deployment-job.json https://raw.githubusercontent.com/EOEPCA/proc-ades/master/test/sample_apps/v2/snuggs/app-deploy-body.json && \
curl -o /var/www/html/examples/deployment-job1.json https://raw.githubusercontent.com/EOEPCA/proc-ades/1b55873dad2684f3333842aea77efb6fb33aa210/test/sample_apps/dNBR/app-deploy-body1.json && \
curl -o /var/www/html/examples/deployment-job2.json https://raw.githubusercontent.com/EOEPCA/proc-ades/master/test/sample_apps/v2/dNBR/app-deploy-body.json && \
curl -o /var/www/html/examples/deployment-job.yaml https://raw.githubusercontent.com/EOEPCA/app-snuggs/main/app-package.cwl && \
cd .. && rm -rf ZOO-Project
#
# Install Swagger-ui
#
RUN git clone --depth 1 https://github.com/swagger-api/swagger-ui.git && \
mv swagger-ui /var/www/html/swagger-ui && \
sed "s=https://petstore.swagger.io/v2/swagger.json=http://localhost/ogc-api/api=g" -i /var/www/html/swagger-ui/dist/* && \
mv /var/www/html/swagger-ui/dist /var/www/html/swagger-ui/oapip
COPY assets/default.conf /etc/apache2/sites-available/000-default.conf
RUN chmod -R 777 /usr/lib/cgi-bin
RUN mkdir /tmp/cookiecutter-templates && \
chmod -R 777 /tmp/cookiecutter-templates
EXPOSE 80
CMD ["apachectl", "-D", "FOREGROUND"]