Skip to content

Commit

Permalink
#32 #61 move to GDAL2, more work on Alpine Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
justb4 committed Oct 31, 2017
1 parent 7ed6bf2 commit 81679d4
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 21 deletions.
42 changes: 35 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,31 @@ LABEL maintainer "Just van den Broecke <justb4@gmail.com>"
ENV LC_ALL "en_US.UTF-8"
ENV LANG "en_US.UTF-8"
ENV LANGUAGE "en_US.UTF-8"
ENV GDAL_VERSION 2.1.3

ARG TZ="Europe/Amsterdam"

RUN apk add --no-cache --virtual .build-deps gcc build-base linux-headers postgresql-dev \
RUN \
# Add edge repo
# echo '@edge http://dl-cdn.alpinelinux.org/alpine/edge/main' >> /etc/apk/repositories && \
# echo '@edge http://dl-cdn.alpinelinux.org/alpine/edge/community' >> /etc/apk/repositories && \
echo '@edge http://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories && \

# Update packages
apk --no-cache upgrade


RUN apk add --no-cache --virtual .build-deps gcc build-base linux-headers postgresql-dev tzdata \
&& apk add --no-cache \
bash \
vim \
tzdata \
&& echo $TZ > /etc/timezone \
&& cp /usr/share/zoneinfo/$TZ /etc/localtime \
&& rm -rf /var/cache/apk/* /tmp/* /var/tmp/*

RUN apk add --no-cache \
expat \
expat-dev \
libxml2-dev \
libxslt-dev \
postgresql-client \
Expand All @@ -35,18 +46,35 @@ RUN apk add --no-cache \
--repository http://nl.alpinelinux.org/alpine/edge/testing \
&& rm -rf /var/cache/apk/* /tmp/* /var/tmp/*

RUN pip install gdal==2.1.3 \
&& pip install Jinja2 \
&& pip install lxml \
&& pip install nose2 \
&& pip install mock
# May need to build APK ourselves example:
# https://github.com/HBKEngineering/alpine-packages
# original is here: https://git.alpinelinux.org/cgit/aports/tree/testing/gdal/APKBUILD
# use Docker to build with Alpine APK SDK :
# https://github.com/andyshinn/docker-alpine-abuild

# Install GDAL by compile, takes extremely long!
# RUN \
# example at https://github.com/winsento/geoserver-alpine/blob/master/2.8/Dockerfile
# wget http://download.osgeo.org/gdal/${GDAL_VERSION}/gdal-${GDAL_VERSION}.tar.gz -O /tmp/gdal.tar.gz && \
# tar xzf /tmp/gdal.tar.gz -C /tmp && \
# cd /tmp/gdal-${GDAL_VERSION} && ./configure --prefix=/usr --with-curl=/usr/bin/curl-config --with-expat && make && make install

RUN \
pip install -U pip && \
pip install gdal==${GDAL_VERSION} && \
pip install psycopg2==2.7.3.2 && \
pip install Jinja2==2.9.6 && \
pip install lxml==4.1.0 && \
pip install nose2 && \
pip install mock

# Add Source Code
ADD . /stetl

# Install and Remove build-related packages for smaller image size
RUN cd /stetl \
&& python setup.py install \
&& nose2 \
&& apk del .build-deps

# Allow docker run
Expand Down
4 changes: 1 addition & 3 deletions examples/basics/12_gdal_ogr/etl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@
# Shortcut to call Stetl main.py with etl config.
#

# stetl -c etl.cfg
../../../stetl/main.py -c etl.cfg

stetl -c etl.cfg
Binary file modified examples/basics/12_gdal_ogr/output/cities.dbf
Binary file not shown.
Binary file modified examples/basics/3_shape/output/gmlcities.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions examples/basics/3_shape/temp/gmlcities.gfs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<ElementPath>City</ElementPath>
<GeometryName>geometry</GeometryName>
<GeometryElementPath>geometry</GeometryElementPath>
<!--POINT-->
<GeometryType>1</GeometryType>
<SRSName>GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]</SRSName>
<DatasetSpecificInfo>
Expand Down
5 changes: 5 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
psycopg2==2.7.3.2
lxml==4.1.0
Jinja2==2.9.6
GDAL>=2
argparse ; python_version < '2.7'
12 changes: 2 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import logging
import sys
from setuptools import setup, find_packages

# To publish: python setup.py sdist upload -r pypi
Expand Down Expand Up @@ -33,15 +32,8 @@
with open('CHANGES.txt', 'r') as f:
changes = f.read()

requirements = [
'psycopg2',
'lxml',
'GDAL',
'Jinja2'
]

if sys.version_info < (2, 7):
requirements.append('argparse')
with open('requirements.txt') as f:
requirements = f.read().splitlines()

setup(
name='Stetl',
Expand Down
1 change: 1 addition & 0 deletions stetl/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ def xpath_get(mydict, path):
from osgeo import ogr
from osgeo import osr
except ImportError:
log.warn("No osgeo.gdal|ogr|osr packages found, trying direct import...")
try:
import gdal
import ogr
Expand Down
2 changes: 1 addition & 1 deletion stetl/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.1.0rc4"
__version__ = "1.1.0rc5"

0 comments on commit 81679d4

Please sign in to comment.