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

Use Docker containers on TravisCI #13

Closed
leouieda opened this issue Aug 13, 2018 · 8 comments
Closed

Use Docker containers on TravisCI #13

leouieda opened this issue Aug 13, 2018 · 8 comments
Labels
help wanted We need some help!

Comments

@leouieda
Copy link
Member

In #5, we're installing our dependencies on Travis using apt-get, which isn't recommended by them. It would be best to have a Docker container that has all of the dependencies installed and we run the tests inside of it. That way we can reproduce the build environment locally if needed.

Some help setting this up would be greatly appreciated because we don't have experience with Docker.

cc @bakerunavco

@leouieda leouieda added the help wanted We need some help! label Aug 13, 2018
@akshmakov
Copy link

akshmakov commented Aug 13, 2018

I have a functioning docker container which currently has an in-container build for testing purposes.However, it can easily be adapted to serve as a base image for CI/CD

You can simply use the first part of the Dockerfile to configure the environment. Second part fetches GSSHG and DCW data, third part builds gmt using a simplistic build script.

Dependencies will have to be updated for 5.x builds but that was on my road map as well.

https://github.com/nc5ng/gmt-docker/blob/master/Dockerfile

## Dockerfile for Base GMT Image nc5ng/gmt for 6.0.0 branch
##     (Currently master)
##
## Approach: Perform development build in situ
##
## Construct and delete the build environment.
## This reduces image size at expense of longer build.
## Also fetch DCW/GSSHG data first, this extends layer cache
## between subsequent builds (less to re-download)
##
FROM ubuntu:16.04
LABEL maintainer="akshmakov@nc5ng.org"

## Part 1: Base Image and Run Dependencies

ARG BIN_DEPS="wget libnetcdf11 libgdal1i libfftw3-3 libpcre3 liblapack3 graphicsmagick liblas3"
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update					 &&\
    apt-get install -y					   \
    	    software-properties-common 			   \
	    python-software-properties 			   \
	    $BIN_DEPS					 &&\
    add-apt-repository universe        			 &&\
    apt-get purge -y                   		   \
            software-properties-common 			   \
	    python-software-properties 			 &&\
    apt-get autoremove -y 				 &&\
    rm -rf /var/lib/apt/lists/*          

## Part 2: GSHHG and DCW Base Data

ARG GSHHG_VERSION=2.3.7
ARG DCW_VERSION=1.1.4
ENV GMT_DCW_FTP=ftp://ftp.soest.hawaii.edu/dcw/dcw-gmt-$DCW_VERSION.tar.gz \
    GMT_GSHHG_FTP=ftp://ftp.soest.hawaii.edu/gshhg/gshhg-gmt-$GSHHG_VERSION.tar.gz

RUN   mkdir -p /opt/gmt					 &&\
      cd /opt/gmt				 	 &&\
      wget $GMT_DCW_FTP					 &&\
      wget $GMT_GSHHG_FTP		 		 &&\
      tar -xzf gshhg-gmt-$GSHHG_VERSION.tar.gz 		 &&\
      tar -xzf dcw-gmt-$DCW_VERSION.tar.gz 		 &&\
      rm -f *.tar.gz                       		   \
    

## Part 3: Download and Build GMT

ARG GMT_BRANCH=trunk
ARG GMT_CMAKE_ARGS=""	    
ARG BUILD_DEPS="subversion build-essential cmake libcurl4-gnutls-dev \
	    libnetcdf-dev libgdal1-dev libfftw3-dev libpcre3-dev \
	    liblapack-dev libblas-dev "

COPY install.sh /opt/gmt/install.sh

RUN apt-get update 					&&\
    apt-get install -y $BUILD_DEPS     			&&\
    (							  \
        cd /opt/gmt 					&&\	
    	./install.sh fetch_src 				&&\
	./install.sh build  				&&\
	./install.sh clean_src 				  \
    ) 		     	       				&&\
    apt-get purge  -y $BUILD_DEPS			&&\
    apt-get autoremove -y 				&&\
    rm -rf /var/lib/apt/lists/*

WORKDIR /workspace

ENTRYPOINT ["/usr/local/bin/gmt"]

P.S. I am also happy to transition the image hierarchy to the GMT organization

@leouieda
Copy link
Member Author

Hi @akshmakov thanks for the help! That sounds like what we needed. Our current scripts are in the ci folder and are called from .travis.yml. Do you think you could modify them to use your container instead?

Would you like to try doing this yourself? I know you're familiar with Github but I can help with anything you need. We're always glad to have more people involved 😃

We can think about moving the container to a GMT organization later.

@akshmakov
Copy link

@leouieda Sounds good, Im working on adapting my existing image for CI. Should have a PR to review in the next day or two after I run some tests.

@akshmakov
Copy link

@leouieda is there any chance ftp.soest.hawaii.edu has some rate limiting set up for Travis IP's? I am having ftp download fails that only happen on travis builds and not consistently, but never seen on my build farm or dockerhub directly.

Is there a mirror that I can try for GSHHG and DCW datasets?

@leouieda
Copy link
Member Author

Should have a PR to review in the next day or two after I run some tests.

Perfect!

Is there a mirror that I can try for GSHHG and DCW datasets?

@akshmakov yeah, there is something wrong with the ftp downloads. I'm using http to download from the source sites instead of the gmt site. See https://github.com/GenericMappingTools/gmt/blob/master/ci/travis-setup.sh

@seisman
Copy link
Member

seisman commented Jan 5, 2019

I think we should at least provide following docker images:

  1. images for each release (e.g. 5.4.5, with GMT 5.4.5 installed)
  2. images for latest GMT5 and GMT6
  3. image for normal travis builds (with GMT dependencies installed and gshhg, dcw downloaded)
  4. image for cron travis builds (with GMT dependencies, gshhg, dcw, python/sphinx, maybe latex)

@PaulWessel
Copy link
Member

Leaving this for @leouieda to comment on (he is on travel) as I don't know about docker images...

@leouieda
Copy link
Member Author

@seisman I've kind of changed my mind of the whole Docker thing:

  1. There is no advantage to use a docker image on Travis under Linux. The main bottle neck is downloading the coastlines and compiling GMT. Both of these would still be needed (when downloading the docker image).
  2. Using docker on Mac defeats the purpose of testing on Mac.

It might be useful to provide GMT enabled Docker images for end users who might want them. But might be too much work to maintain a version for master. Either way, probably better for another issue since this one is specifically for Travis.

rbdavis added a commit that referenced this issue Feb 25, 2024
joa-quim added a commit that referenced this issue Mar 3, 2024
* WIP Batch #13 of longoptions test scripts.

* Update psconvert-l2s.sh

* Update triangulate-l2s.sh

* Update grdfft-l2s.sh

* Update sphinterpolate-l2s.sh

* Update greenspline-l2s.sh

* Update greenspline-l2s.sh

---------

Co-authored-by: Paul Wessel <pwessel@hawaii.edu>
Co-authored-by: Joaquim <jmfluis@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted We need some help!
Projects
None yet
Development

No branches or pull requests

4 participants