Skip to content

Commit

Permalink
#71 Allow Environment vars to substitute/override config vars - fix t…
Browse files Browse the repository at this point in the history
…ests for Docker build
  • Loading branch information
justb4 committed Apr 3, 2018
1 parent 37be0de commit 1076388
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 24 deletions.
34 changes: 18 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
FROM debian:stretch-slim

LABEL maintainer "Just van den Broecke <justb4@gmail.com>"
LABEL maintainer="Just van den Broecke <justb4@gmail.com>"

#
# ARGS

#
ARG TIMEZONE="Europe/Amsterdam"
ENV TZ=${TIMEZONE}

ARG LOCALE="en_US.UTF-8"

# ARG ADD_PYTHON_DEB_PACKAGES="python-scipy python-seaborn python-matplotlib"
ARG ADD_PYTHON_DEB_PACKAGES=""
# ARG ADD_PYTHON_PIP_PACKAGES="scikit-learn==0.18"
ARG ADD_PYTHON_PIP_PACKAGES=""

# General ENV settings
ENV LC_ALL="${LOCALE}"
ENV LC_TYPE="${LOCALE}"
ENV LANG="${LOCALE}"
ENV LANGUAGE="${LOCALE}"
ENV DEBIAN_FRONTEND="noninteractive"
ENV BUILD_DEPS="tzdata locales"
ENV PYTHON_CORE_PACKAGES="cython python-requests python-tz python-numpy python-pandas python-setuptools python-pip python-lxml python-gdal python-psycopg2 python-jinja2 gdal-bin"
ENV PYTHON_TEST_PACKAGES="python-nose2 python-mock"
ENV PYTHON_EXTRA_DEB_PACKAGES="${ADD_PYTHON_DEB_PACKAGES}"
ENV PYTHON_EXTRA_PIP_PACKAGES="${ADD_PYTHON_PIP_PACKAGES}"
#
# ENV settings
#
ENV TZ=${TIMEZONE} \
LC_ALL="${LOCALE}" \
LC_TYPE="${LOCALE}" \
LANG="${LOCALE}" \
LANGUAGE="${LOCALE}" \
DEBIAN_FRONTEND="noninteractive" \
BUILD_DEPS="tzdata locales" \
PYTHON_CORE_PACKAGES="cython python-requests python-tz python-numpy python-pandas python-setuptools python-pip python-lxml python-gdal python-psycopg2 python-jinja2 gdal-bin" \
PYTHON_TEST_PACKAGES="python-nose2 python-mock" \
PYTHON_EXTRA_DEB_PACKAGES="${ADD_PYTHON_DEB_PACKAGES}" \
PYTHON_EXTRA_PIP_PACKAGES="${ADD_PYTHON_PIP_PACKAGES}"

# Add Source Code
ADD . /stetl
Expand All @@ -46,7 +48,7 @@ RUN \
# Locale
&& echo "LANG=${LANG}" >/etc/default/locale \
&& echo "${LANG} UTF-8" > /etc/locale.gen \
&& locale-gen\
&& locale-gen \
&& dpkg-reconfigure locales \
&& /usr/sbin/update-locale LANG=${LANG} \

Expand Down
2 changes: 1 addition & 1 deletion tests/outputs/configs/ogr2ogrexecoutput.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class = outputs.execoutput.Ogr2OgrExecOutput
dest_format = PostgreSQL
dest_data_source = "PG:dbname=dummydb host=dummyhost port=dummyport user=dummyuser password=dummypassword active_schema=dummyschema"
# miscellaneous ogr2ogr options
options = -append -gt 65536 {multi_opts} --config PG_USE_COPY NO
options = -append -gt 65536 -fieldTypeToString StringList --config PG_USE_COPY NO

[output_ogr2ogr_gfs]
class = outputs.execoutput.Ogr2OgrExecOutput
Expand Down
12 changes: 6 additions & 6 deletions tests/outputs/configs/postgresdboutput.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ file_path = tests/data/dummy.sql

[output_postgres]
class = outputs.dboutput.PostgresDbOutput
database = {database}
host = {host}
port = {port}
user = {user}
password = {password}
schema = {schema}
database = database
host = host
port = port
user = user
password = password
schema = schema
2 changes: 1 addition & 1 deletion tests/outputs/test_ogr2ogr_exec_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def test_execute_options(self, mock_call):
# Check command line
args, kwargs = mock_call.call_args
list = self.parse_command(args[0])
self.assertEqual(len(list), 12)
self.assertEqual(len(list), 13)

# Check spatial extent
self.assertTrue('-append' in list)
Expand Down

0 comments on commit 1076388

Please sign in to comment.