Closed staffan-einarsson closed 4 years ago
@staffan-einarsson thanks for this PR - regarding Debian or ubuntu, I see that in Debian buster GDAL is at version 2.4.0, on ubuntu bionic with the ubuntugis-stable
PPA is at 2.4.2, is there a strong reason to prefer Debian vs ubuntu+PPA?
I don't have a preference for either but ubuntu seems more widely used for this purpose
Hi @bdon! No, not really. My first attempt at this was to use the following Dockerfile.
FROM ubuntu:18.04
RUN apt-get update && apt-get install -yq \
software-properties-common
RUN add-apt-repository ppa:ubuntugis/ppa
RUN apt-get update && apt-get install -yq \
python3-pip \
python3-gdal
RUN pip3 install \
osm-export-tool
COPY bin/docker_entrypoint.sh /bin/docker_entrypoint.sh
ENTRYPOINT [ "/bin/docker_entrypoint.sh" ]
This however gave me the following error when installing osm-export-tool
.
Step 5/7 : RUN pip3 install osm-export-tool
---> Running in 88f0ca9bcf32
Collecting osm-export-tool
Downloading https://files.pythonhosted.org/packages/eb/60/1cde874b3dbfad21eff63c8e7aea6a8361a345641d58831b72313cd4d0be/osm_export_tool-0.0.24-py3-none-any.whl
Collecting pyyaml (from osm-export-tool)
Downloading https://files.pythonhosted.org/packages/64/c2/b80047c7ac2478f9501676c988a5411ed5572f35d1beff9cae07d321512c/PyYAML-5.3.1.tar.gz (269kB)
Collecting landez~=2.5.0 (from osm-export-tool)
Downloading https://files.pythonhosted.org/packages/39/6b/911371692e259223e371a4f5137a4c4a445943da0ae7bed105cd25d5c575/landez-2.5.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-zu8zgsza/landez/setup.py", line 16, in <module>
long_description=open(os.path.join(here, 'README.rst')).read() + '\n\n' +
File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 6505: ordinal not in range(128)
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-zu8zgsza/landez/
The command '/bin/sh -c pip3 install osm-export-tool' returned a non-zero code: 1
This seems to be a problem that goes away with python3.7 and greater, but Bionic stays at 3.6. With Focal we get python3.8, but then the ubuntugis PPA is not fully populated yet. One option is to manually install python3.7 or greater on Bionic but that seemed like more of a hassle, which is why I switched to Debian instead.
Yet another option is to try to get landez
patched because it is kind of silly to try to parse the README.rst file as ASCII in this day and age.
OK, that solution makes sense, I'm fine with using Debian for this. One other concern I have:
RUN pip3 install osm-export-tool
The line here will fetch the osm-export-tool from the PyPI repository, right? This will install the latest version uploaded to PyPI.
I think if a developer is looking at or cloning this Git repository they expect to use or modify the source code, not use the latest code on PyPI. I think there is a way for the Dockerfile to mount the local directory and run pip3 install setup.py
, do you think that would be a preferred approach?
Yes, that sounds like more intuitive behavior. I'll update.
By the way, would it be possible to set this up to automatically build/publish in Docker Hub?
@staffan-einarsson is that something you can upload that can be community maintained? I don't have any plans to use the Docker version myself.
I don't think that I can set up automatic builds in Docker Hub without connecting to the corresponding organization here in github. It would mean that I'd have to set it up to monitor my fork of this repo, but then there would be a manual process of keeping that fork in sync. So, unless you have any interest in this, I don't think it is a good idea.
I don't expect that this repository will move quickly as I'm not actively developing any new features. If you do decide to put your fork on Docker Hub and many users are accessing it that way, we can consider it in the future.
Thanks!
Addresses #10
This adds a Dockerfile based on Debian Buster, which was a lot easier to work with in this case since the Ubuntu PPAs for GDAL are not set up for newer releases. Also the python bindings are readily available as an apt install.
Added some notes to the readme on how to build and run this.