-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.template
82 lines (70 loc) · 2.47 KB
/
Dockerfile.template
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
# Version 1.0 template-transformer-simple
FROM base-image
LABEL maintainer=""
# Add user
RUN useradd -u 49044 extractor \
&& mkdir /home/extractor
RUN chown -R extractor /home/extractor \
&& chgrp -R extractor /home/extractor
# Install the Python version we want
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
python3.7 \
python3-pip && \
ln -sfn /usr/bin/python3.7 /usr/bin/python && \
ln -sfn /usr/bin/python3.7 /usr/bin/python3 && \
ln -sfn /usr/bin/python3.7m /usr/bin/python3m && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Perform some upgrades
RUN python3 -m pip install --upgrade --no-cache-dir pip
RUN python3 -m pip install --upgrade --no-cache-dir setuptools
# Install applications we need
RUN apt-get update && \
apt-get install -y --no-install-recommends \
python3-gdal \
gdal-bin \
libgdal-dev \
gcc \
g++ \
python3.7-dev && \
python3 -m pip install --upgrade --no-cache-dir \
wheel && \
python3 -m pip install --upgrade --no-cache-dir \
numpy && \
python3 -m pip install --upgrade --no-cache-dir \
pygdal==2.2.3.* && \
apt-get remove -y \
libgdal-dev \
gcc \
g++ \
python3-dev && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install the requirements we need for this Transformer
COPY requirements.txt packages.txt /home/extractor/
USER root
RUN [ -s /home/extractor/packages.txt ] && \
(echo 'Installing packages' && \
apt-get update && \
cat /home/extractor/packages.txt | xargs apt-get install -y --no-install-recommends && \
rm /home/extractor/packages.txt && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*) || \
(echo 'No packages to install' && \
rm /home/extractor/packages.txt)
RUN [ -s /home/extractor/requirements.txt ] && \
(echo "Install python modules" && \
python3 -m pip install -U --no-cache-dir pip && \
python3 -m pip install --no-cache-dir setuptools && \
python3 -m pip install --no-cache-dir -r /home/extractor/requirements.txt && \
rm /home/extractor/requirements.txt) || \
(echo "No python modules to install" && \
rm /home/extractor/requirements.txt)
USER extractor
COPY *.py /home/extractor/
ENTRYPOINT ["python3","/home/extractor/transformer.py"]