Debian Codegraph @

Dockerfile

raw
1 FROM debian:buster-slim
2
3 LABEL maintainer="Just van den Broecke <[email protected]>"
4
5 #
6 # ARGS
7 #
8 ARG TIMEZONE="Europe/Amsterdam"
9 ARG LOCALE="en_US.UTF-8"
10
11 ARG ADD_PYTHON_DEB_PACKAGES=""
12 ARG ADD_PYTHON_PIP_PACKAGES=""
13
14 # Tricky: must match installed GDAL version (2.1.2 on Stretch, 2.4.0 on Buster)
15 ARG GDAL_PYTHON_BINDINGS_VERSION="2.4.0"
16
17 #
18 # ENV settings
19 #
20 ENV TZ=${TIMEZONE} \
21 DEBIAN_FRONTEND="noninteractive" \
22 BUILD_DEPS="tzdata build-essential apt-utils libgdal-dev python3-pip python3-setuptools python3-dev" \
23 PYTHON_CORE_PACKAGES="locales python3-requests libgdal20 python3-gdal gdal-bin python3-tz python3-numpy python3-pandas python3-setuptools python3-lxml python3-psycopg2 python3-jinja2" \
24 PYTHON_EXTRA_DEB_PACKAGES="${ADD_PYTHON_DEB_PACKAGES}" \
25 PYTHON_EXTRA_PIP_PACKAGES="${ADD_PYTHON_PIP_PACKAGES}"
26
27 # Add Source Code
28 ADD . /stetl
29
30 # Set time right and configure timezone and locale
31 RUN \
32 apt-get update \
33 && apt-get --no-install-recommends install -y \
34 ${BUILD_DEPS} \
35 ${PYTHON_CORE_PACKAGES} \
36 ${PYTHON_EXTRA_DEB_PACKAGES} \
37 # Timezone
38 && cp /usr/share/zoneinfo/${TZ} /etc/localtime\
39 && dpkg-reconfigure tzdata \
40 # Locale
41 && sed -i -e "s/# ${LOCALE} UTF-8/${LOCALE} UTF-8/" /etc/locale.gen \
42 && dpkg-reconfigure --frontend=noninteractive locales \
43 && update-locale LANG=${LOCALE} \
44 && pip3 install GDAL==${GDAL_PYTHON_BINDINGS_VERSION} ${PYTHON_EXTRA_PIP_PACKAGES} \
45 # Install and Remove build-related packages for smaller image size
46 && cd /stetl \
47 && python3 setup.py install \
48 && apt-get remove --purge ${BUILD_DEPS} -y \
49 && apt autoremove -y \
50 && rm -rf /var/lib/apt/lists/*
51
52 ENV LANG="${LOCALE}" LANGUAGE="${LOCALE}"
53 RUN echo "For ${TZ} date=`date`" && echo "Locale=`locale`"
54
55 # Run examples
56 # docker run --rm -it geopython/stetl stetl
57 # docker run --rm -v $(pwd):/work -w /work geopython/stetl:2.0 stetl -c etl.cfg