Skip to content

Commit

Permalink
Update the build system to use a Makefile.
Browse files Browse the repository at this point in the history
This allows for a 'mixin' approach when building the image and means it doesn't
derive from the `geodata/gdal` image any more but uses `ubuntu:trusty` instead.
  • Loading branch information
Homme Zwaagstra committed Aug 6, 2015
1 parent 980fbfa commit e9a9ba3
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 40 deletions.
30 changes: 8 additions & 22 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,13 @@
# Builder software (https://github.com/geo-data/cesium-terrain-builder).
#

FROM geodata/gdal:latest
# Ubuntu 14.04 Trusty Tahyr
FROM ubuntu:trusty
MAINTAINER Homme Zwaagstra <[email protected]>

# Install as root
USER root

# Upgrade from gcc 4.6 to 4.7 (see
# http://askubuntu.com/questions/113291/how-do-i-install-gcc-4-7)
RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test
RUN apt-get update -y
RUN apt-get install -y gcc-4.7 g++-4.7
RUN apt-get remove -y gcc-4.6
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.7

# Ensure `cmake` is present
RUN apt-get install -y cmake

# Install Cesium Terrain Builder itself
ADD ./ctb-checkout.txt /tmp/ctb-checkout.txt
ADD ./install-ctb.sh /tmp/
RUN sh /tmp/install-ctb.sh

# Clean up APT when done
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install the application.
ADD . /usr/local/src/cesium-terrain-builder/
RUN apt-get update -y && \
apt-get install -y make && \
make -C /usr/local/src/cesium-terrain-builder install clean && \
apt-get purge -y make
60 changes: 60 additions & 0 deletions docker/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
##
# Install Cesium Terrain Builder from within a docker container
#
# This Makefile is designed to be run from within a docker container in order to
# install Cesium Terrain Builder. The following is an example invocation:
#
# make -C /usr/local/src/cesium-terrain-builder install clean
#

# Version related variables.
CTB_VERSION := $(shell cat ./ctb-checkout.txt)
GDAL_VERSION := $(shell cat ./gdal-checkout.txt)

# CTB dependency targets.
CTB := /usr/local/bin/ctb-tile
GDAL_CONFIG := /usr/local/bin/gdal_config
CTB_SRC := /tmp/cesium-terrain-builder-$(CTB_VERSION)

# Build tools.
WGET := /usr/bin/wget

install: $(CTB)

$(CTB): $(CTB_SRC) /tmp/ctb-build $(GDAL_CONFIG)
cd /tmp/ctb-build \
&& cmake $(CTB_SRC) \
&& make -j$$(nproc) \
&& make install \
&& ldconfig \
&& touch -c $(CTB)

/tmp/ctb-build:
mkdir -p /tmp/ctb-build

$(CTB_SRC): $(WGET)
$(WGET) --no-verbose "https://github.com/geo-data/cesium-terrain-builder/archive/$(CTB_VERSION).tar.gz" -O $(CTB_SRC).tar.gz \
&& tar -C /tmp -xzf $(CTB_SRC).tar.gz \
&& touch -c $(CTB_SRC)

$(GDAL_CONFIG): /usr/local/src/gdal-docker
make -C /usr/local/src/gdal-docker install \
&& touch -c $(GDAL_CONFIG)
/usr/local/src/gdal-docker: $(WGET)
$(WGET) --no-verbose "https://github.com/geo-data/gdal-docker/archive/$(CTB_VERSION).tar.gz" -O /tmp/gdal-docker-$(GDAL_VERSION).tar.gz \
&& tar -C /tmp -xzf /tmp/gdal-docker-$(GDAL_VERSION).tar.gz \
&& mv /tmp/gdal-docker-$(GDAL_VERSION) /usr/local/src/gdal-docker \
&& touch -c /usr/local/src/gdal-docker

$(WGET): /tmp/apt-updated
apt-get install -y wget && touch -c $(WGET)

/tmp/apt-updated:
apt-get update -y && touch /tmp/apt-updated

# Remove build time dependencies. Delegate to gdal-docker clean as this removes
# everything, including wget.
clean:
make -C /usr/local/src/gdal-docker clean

.PHONY: install clean
1 change: 1 addition & 0 deletions docker/gdal-checkout.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
master
18 changes: 0 additions & 18 deletions docker/install-ctb.sh

This file was deleted.

0 comments on commit e9a9ba3

Please sign in to comment.