Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify docker image #12

Merged
merged 17 commits into from
Jul 18, 2019
Merged

Simplify docker image #12

merged 17 commits into from
Jul 18, 2019

Conversation

aruneko
Copy link
Contributor

@aruneko aruneko commented Jul 8, 2019

I modified the docker images to simplify it.

For example, the image size of v3.0.0-dev-postgresql_11 decrease from 1.4GB to 920MB.

The changes is below.

  • Replace base image pgrouting/postgres with mdillon/postgis
    • mdillon/postgis is based on official Postgres image, well-maintained, and built automatically.
    • So we can use latest version of postgresql and postgis easily.
    • And we can refer to an official postgresql docker image document.
    • This is why, I removed postgres directory.
  • Remove osm2pgrouting from this docker image
    • I think the responsibility of this docker image is only providing pgrouting.
    • If you use osm2pgrouting to import OSM data, it is better to create a other container which includes osm2pgrouting.

In addition, I think it is required a CI for building 3.0.0-dev automatically (#4).
But to detect push for the development branch, we have to place CI settings in pgRouting repository.
So if we resolve this issue, we have to consider it.

@cayetanobv
Copy link
Member

Thanks @aruneko . You have done in this PR a lot of work to improve the project!
I've been trying to simplify the way we prepare the base image because it generates a lot of work and it is difficult to maintain. This could be a good opportunity to improve that.

Several things I would like to discuss before proceed:

@cvvergara and @dkastl: What do you think about it?

@cayetanobv cayetanobv self-requested a review July 8, 2019 11:24
@@ -1,16 +1,46 @@
FROM pgrouting/postgres:pg10
FROM mdillon/postgis:10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussing this change in main thread: #12 (comment)

@aruneko
Copy link
Contributor Author

aruneko commented Jul 9, 2019

Thanks for your opinion!

I understand your concern, and I propose this Dockerfile.

for pgrouting 2.6.2

FROM postgres:11

ENV POSTGIS_MAJOR 2.5
ENV PGROUTING_VERSION 2.6.2

RUN apt update \
 && apt install -y \
        build-essential \
        cmake \
        perl \
        wget \
        libboost-graph-dev \
        libcgal-dev \
        libpq-dev \
        # install postgis from apt
        postgresql-${PG_MAJOR}-postgis-${POSTGIS_MAJOR} \
        postgresql-server-dev-${PG_MAJOR} \
 && cd /usr/local/src \
 && wget https://github.com/pgRouting/pgrouting/archive/v${PGROUTING_VERSION}.tar.gz \
 && tar xvf v${PGROUTING_VERSION}.tar.gz \
 && cd pgrouting-${PGROUTING_VERSION} \
 && mkdir build \
 && cd build \
 && cmake .. \
 && make \
 && make install \
 && cd ../../ \
 && rm -rf ./* \
 && apt purge -y \
        build-essential \
        cmake \
        perl \
        wget \
        libcgal-dev \
        libpq-dev \
        postgresql-server-dev-${PG_MAJOR} \
 && apt install -y \
        postgresql-${PG_MAJOR}-postgis-${POSTGIS_MAJOR}-scripts \
        libboost-atomic1.62.0 \
        libboost-chrono1.62.0 \
        libboost-graph1.62.0 \
        libboost-date-time1.62.0 \
        libboost-program-options1.62.0 \
        libboost-system1.62.0 \
        libboost-thread1.62.0 \
        libcgal12 \
 && apt autoremove -y \
 && rm -rf /var/lib/apt/lists/*

for pgrouting 3.0.0

FROM postgres:11

ENV POSTGIS_MAJOR 2.5
ENV PGROUTING_VERSION develop

RUN apt update \
 && apt install -y \
        build-essential \
        cmake \
        perl \
        wget \
        libboost-graph-dev \
        libpq-dev \
        # install postgis from apt
        postgresql-${PG_MAJOR}-postgis-${POSTGIS_MAJOR} \
        postgresql-server-dev-${PG_MAJOR} \
 && cd /usr/local/src \
 && wget https://github.com/pgRouting/pgrouting/archive/${PGROUTING_VERSION}.tar.gz \
 && tar xvf ${PGROUTING_VERSION}.tar.gz \
 && cd pgrouting-${PGROUTING_VERSION} \
 && mkdir build \
 && cd build \
 && cmake .. \
 && make \
 && make install \
 && cd ../../ \
 && rm -rf ./* \
 && apt purge -y \
        build-essential \
        cmake \
        perl \
        wget \
        libpq-dev \
        postgresql-server-dev-${PG_MAJOR} \
 && apt install -y \
        postgresql-${PG_MAJOR}-postgis-${POSTGIS_MAJOR}-scripts \
        libboost-graph1.62.0 \
        libboost-program-options1.62.0 \
 && apt autoremove -y \
 && rm -rf /var/lib/apt/lists/*

regarding osm2pgrouting

The base image postgres:11 is based on Debian stretch. The repository of Debian stretch includes an osm2pgrouting package but the version is 2.2.0, so we cannot install latest version of osm2pgrouting and have to build it for installing. I concern about to be more complex Dockerfile.

I understand the needs of osm2pgrouting, but for production deployment using public cloud (e.g. AWS, GCP), I hope to save as more disk space as possible. So, I think it is required both of docker image which includes it or not. Because, once we create a docker image, we cannot remove any files from it.

But I concern about increase of tags. If possible, I hope to remove support of 2.6.1.

@dkastl
Copy link
Member

dkastl commented Jul 9, 2019

Would it be too much work or a bad idea to make a different Docker image for osm2pgrouting?

I think, that it's good to have a way to install the latest one as a Docker container, because distributions are sometimes slow to update. And I understand, that some people won't need it.

Not sure, what is the most reasonable solution. But I'm very glad about the discussion and the pull request of @aruneko . It actually shows users of this Docker image, that it is well thought and maintained.

@cayetanobv
Copy link
Member

cayetanobv commented Jul 9, 2019

@aruneko I like new Dockerfiles you are proposing. Could you push these changes to PR?

Osm2pgrouting issue

I understand your concern about image size and I think in production is important.
@dkastl It looks good to me to maintain 2 Dockerfiles (one of them including osm2pgrouting) by pRouting version (we can automate it). The question here is: How we could tag osm2pgrouting image in a clearly way? What do you think about it?

@woodbri
Copy link

woodbri commented Jul 9, 2019 via email

@aruneko
Copy link
Contributor Author

aruneko commented Jul 10, 2019

I pushed suggested Dockerfiles.

Then, I propose Dockerfile for a docker image includes osm2pgrouting.

FROM pgrouting/prgouring:3.0.0-dev-11

ENV OSM2PGROUTING_VERSION 2.3.6

RUN apt update \
 && apt install -y \
        build-essential \
        cmake \
        wget \
        libboost-program-options-dev \
        libexpat1 \
        libexpat-dev \
        libosmium2-dev \
        libpqxx-dev \
        zlib1g-dev \
 && cd /usr/local/src \
 && wget https://github.com/pgRouting/osm2pgrouting/archive/v${OSM2PGROUTING_VERSION}.tar.gz \
 && tar xvf v${OSM2PGROUTING_VERSION}.tar.gz \
 && cd osm2pgrouting-${OSM2PGROUTING_VERSION} \
 && mkdir build \
 && cd build \
 && cmake .. \
 && make \
 && make install \
 && cd ../tools/osmium/ \
 && mkdir build \
 && cd build \
 && cmake .. \
 && make \
 && make install \
 && cd /usr/local/src \
 && rm -rf ./* \
 && apt purge -y \
        build-essential \
        cmake \
        wget \
        libexpat-dev \
        libosmium2-dev \
        libpqxx-dev \
        zlib1g-dev \
 && apt install -y \
        libpqxx-4.0v5 \
 && apt autoremove -y \
 && rm -rf /var/lib/apt/lists/*

@cayetanobv
Copy link
Member

Thanks @aruneko . Dockerfile for osm2pgrouting looks good to me (only a typo in name: pgrouting/prgouring:3.0.0-dev-11 -> pgrouting/pgrouting:3.0.0-dev-11). Could you push these changes.

Naming

I think we only need to find a name for this image to differentiate from "main". Following the proposal by @woodbri , I've added another name more (added to docker image "tag"):

  • -plus
  • -fat
  • -ext (stands for extended version)

What do you think?

@dkastl
Copy link
Member

dkastl commented Jul 11, 2019

-plus sounds as it would be better.
What about -extra or -osm?

@cayetanobv
Copy link
Member

-plus sounds as it would be better.
What about -extra or -osm?

@dkastl I like -extra. I think the goal is very clear.

@@ -1,3 +1,3 @@
# pgRouting 3.0.0-dev (pg10)

pgRouting Docker image (version 3.0.0-dev) built over [Postgres 10 with PostGIS](../../postgres/pg10) and dependencies.
pgRouting Docker image (version 3.0.0-dev) built over [Postgres 10 with PostGIS](https://hub.docker.com/r/mdillon/postgis) and dependencies.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change link url.

@woodbri
Copy link

woodbri commented Jul 11, 2019

+1 on -extra. better to keep it generic then we can put other stuff into it also and not have to have a separate one for everything we might want to add in the future.

@aruneko
Copy link
Contributor Author

aruneko commented Jul 13, 2019

I pushed Dockerfile for -extra, and fixed URL on README.

@cayetanobv
Copy link
Member

Thank you @aruneko I'm going to review all changes to proceed with this PR.

@cayetanobv cayetanobv changed the base branch from master to development July 18, 2019 15:34
@cayetanobv
Copy link
Member

@aruneko I've changed base branch to development. I will merge with master after some testing.

@cayetanobv cayetanobv merged commit ee375ea into pgRouting:development Jul 18, 2019
@aruneko
Copy link
Contributor Author

aruneko commented Jul 19, 2019

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants