forked from opendatacube/datacube-wps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
101 lines (74 loc) · 2.97 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
ARG py_env_path=/env
FROM csiroeasi/geobase-builder:master.latest as env_builder
ARG py_env_path
RUN mkdir -p /conf
COPY requirements.txt /conf
COPY constraints.txt /conf
RUN python3 -m venv ${py_env_path} && \
${py_env_path}/bin/python -m pip install --no-cache-dir ${PIP_EXTRA_ARGS} -U pip wheel setuptools setuptools_scm scikit-build -c /conf/constraints.txt
RUN ${py_env_path}/bin/python -m pip install --no-cache-dir -r /conf/requirements.txt -c /conf/constraints.txt
RUN ${py_env_path}/bin/python -m pip install git+https://github.com/altair-viz/altair.git@master
ENV PATH=${py_env_path}/bin:$PATH
FROM csiroeasi/geobase-runner:master.latest
RUN mkdir -p /code/logs
RUN mkdir -p /code/outputs
WORKDIR /code
ENV DEBIAN_FRONTEND=noninteractive
# Use for local builds to find a local apt mirror
# RUN apt-get update -y && apt install -y --fix-missing --no-install-recommends wget ca-certificates && \
# wget http://ftp.us.debian.org/debian/pool/main/n/netselect/netselect_0.3.ds1-29_amd64.deb && \
# dpkg -i netselect_0.3.ds1-29_amd64.deb && \
# export APT_MIRROR=$(netselect -s 1 -t 20 $(wget -qO - mirrors.ubuntu.com/mirrors.txt) | awk '{print $2}') && \
# echo $APT_MIRROR && \
# sed -i -r "s#http:\/\/archive.ubuntu.com\/ubuntu\/#${APT_MIRROR}#" /etc/apt/sources.list
RUN apt-get update -y && apt-get install -y --fix-missing --no-install-recommends \
curl \
wget \
git \
build-essential \
libcairo2-dev \
libpango1.0-dev \
libjpeg-dev \
libgif-dev \
librsvg2-dev \
curl \
wget \
git \
&& rm -rf /var/lib/apt/lists/*
# install nodejs & vega-lite (for saving altair charts to svg)
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash - \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --fix-missing --no-install-recommends \
nodejs
RUN sudo npm install vega-lite vega-cli canvas -g
COPY --from=env_builder /bin/tini /bin/tini
ARG py_env_path
COPY --from=env_builder $py_env_path $py_env_path
ENV LC_ALL=C.UTF-8
ENV SHELL=bash
# Put `/usr/local/bin` before env to allow overrides in there
ENV PATH=/usr/local/bin:${py_env_path}/bin:$PATH
ADD . /code
WORKDIR /code
RUN pip install --no-deps .
COPY docker/wps-entrypoint.sh /usr/local/bin/wps-entrypoint.sh
RUN useradd -m -s /bin/bash -N -g 100 -u 1001 wps
RUN chmod 777 /code/pywps.cfg \
&& chmod 777 /code/datacube-wps-config.yaml \
&& chown wps:users /code/logs \
&& chown wps:users /code
RUN chmod -R 777 /code/outputs \
&& chown wps:users /code/outputs
# Debugging?
# RUN chmod -R 777 /code/geckodriver.log \
# && chown wps:users /code/geckodriver.log
# For AWS CLI
# RUN apt-get install unzip
# RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
# RUN unzip awscliv2.zip
# RUN ./aws/install
# For debugging
# RUN apt-get install -y vim
# RUN curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh" | bash
ENTRYPOINT ["wps-entrypoint.sh"]
USER wps
CMD gunicorn -b 0.0.0.0:8000 datacube_wps:app