-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
81 lines (69 loc) · 2.43 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
# Version 1.0 template-transformer-simple
FROM ubuntu:20.04
LABEL maintainer="Chris Schnaufer <[email protected]>"
ENV DEBIAN_FRONTEND noninteractive
# 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.8 \
python3-pip && \
ln -sfn /usr/bin/python3.8 /usr/bin/python && \
ln -sfn /usr/bin/python3.8 /usr/bin/python3 && \
ln -sfn /usr/bin/python3.8m /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
# Install applications we need
RUN apt-get update && \
apt-get install -y --no-install-recommends \
python3-gdal \
gdal-bin \
libgdal-dev \
gcc \
g++ \
python3.8-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==3.0.4.* && \
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 -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"]