Skip to content

Instantly share code, notes, and snippets.

@nicerobot
Last active May 8, 2017 00:55
Show Gist options
  • Save nicerobot/84ebf7c210c0b53ec971b7113b17a607 to your computer and use it in GitHub Desktop.
Save nicerobot/84ebf7c210c0b53ec971b7113b17a607 to your computer and use it in GitHub Desktop.
gogeos Dockerfile build
#!/bin/bash
go build -v -x -ldflags='-s -w' -a -installsuffix cgo -o app${GO_VERSION}.${GOOS}_${GOARCH}
FROM python:3.4
RUN apt-get update
RUN apt-get install --yes \
git \
mercurial \
bzr \
openssh-client \
byobu \
git \
htop \
man \
unzip \
vim \
wget \
&& true
RUN wget http://download.osgeo.org/geos/geos-3.5.1.tar.bz2 \
&& tar xfj geos-3.5.1.tar.bz2 \
&& cd geos-3.5.1 \
&& ./configure \
&& make \
&& make check \
&& make install \
&& ldconfig
# RUN export CPLUS_INCLUDE_PATH=/usr/include/gdal C_INCLUDE_PATH=/usr/include/gdal && pip install --no-cache-dir GDAL==1.10
RUN apt-get install --yes \
pkg-config \
libcurl4-openssl-dev \
libxml2-dev \
libgit2-dev \
libproj-dev \
libgdal-dev \
libblas-dev \
libpng-dev \
libopenblas-base \
libatlas3-base \
libfreetype6-dev \
python3-dev \
python3-numpy \
python3-scipy \
gdal-bin \
&& true
RUN rm -rf /var/lib/apt/lists/*
RUN pip install \
SQLAlchemy==1.0.13 \
Shapely==1.5.17 \
click==6.7 \
click-plugins==1.0.3 \
cligj==0.4.0 \
crate==0.16.4 \
cycler==0.10.0 \
descartes==1.1.0 \
fiona==1.7.5 \
geojson==1.3.4 \
geopandas==0.2.1 \
matplotlib==2.0.0 \
munch==2.1.1 \
numpy==1.11.2 \
pandas==0.19.1 \
pyparsing==2.2.0 \
pyproj==1.9.5.1 \
python-dateutil==2.6.0 \
pytz==2017.2 \
requests==2.9.1 \
scikit-learn==0.18.1 \
scipy==0.17.1 \
six==1.10.0 \
sklearn==0.0 \
urllib3==1.21
ARG GO_VERSION
ENV GO_VERSION=${GO_VERSION}
ENV GOOS linux
ENV GOARCH amd64
ENV PATH ${PWD}/go/bin:${PATH}
RUN curl -Ls -o- "https://storage.googleapis.com/golang/go${GO_VERSION}.${GOOS}-${GOARCH}.tar.gz" | tar xz
RUN mkdir /gopath
ENV GOPATH /gopath
ENV GOROOT /go
ENV HOME /
ENV TMP /
ENV TEMP /
RUN go get -v \
github.com/ansel1/merry \
github.com/fatih/structs \
github.com/go-errors/errors \
github.com/go-kit/kit \
github.com/go-logfmt/logfmt \
github.com/go-stack/stack \
github.com/golang/groupcache \
github.com/golang/protobuf \
github.com/gorilla/handlers \
github.com/gorilla/mux \
github.com/hashicorp/consul \
github.com/jmoiron/sqlx \
github.com/jmoiron/sqlx/reflectx \
github.com/paulmach/go.geojson \
github.com/paulmach/go.geojson \ \
github.com/paulsmith/gogeos \
github.com/paulsmith/gogeos/geos \
github.com/pborman/uuid \
github.com/pkg/errors \
github.com/StefanSchroeder/Golang-Ellipsoid \
github.com/TomiHiltunen/geohash-golang \
golang.org/x/net/context \
golang.org/x/sync/errgroup \
gopkg.in/stack.v1 \
gopkg.in/yaml.v2 \
|| true
WORKDIR /gopath/src/gogeos
ENTRYPOINT ["/bin/bash", "compile"]
package main
import (
"fmt"
)
func main() {
fmt.Println("Hello, gogeos!")
}
help:
@echo usage: make build|run
build:
docker build --build-arg GO_VERSION=1.7.3 --tag gogeos_builder:1.7.3 .
docker build --build-arg GO_VERSION=1.8.1 --tag gogeos_builder:1.8.1 .
run:
docker run --rm -v ${PWD}:/gopath/src/gogeos gogeos_builder:1.7.3 gogeos
docker run --rm -v ${PWD}:/gopath/src/gogeos gogeos_builder:1.8.1 gogeos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment