Last active
November 7, 2019 00:17
-
-
Save ali-ince/b6b883edfce74f3e536d77eafb96ca07 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# start from golang image based on alpine-3.8 | |
FROM golang:1.10-alpine3.8 AS dev-build | |
# add our cgo dependencies | |
RUN apk add --no-cache ca-certificates cmake make g++ openssl-dev git curl pkgconfig | |
# clone latest seabolt 1.7 source code | |
RUN git clone -b 1.7 https://github.com/neo4j-drivers/seabolt.git /seabolt | |
# invoke cmake build and install artifacts - default location is /usr/local | |
WORKDIR /seabolt/build | |
# CMAKE_INSTALL_LIBDIR=lib is a hack where we override default lib64 to lib to workaround a defect | |
# in our generated pkg-config file | |
RUN cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_LIBDIR=lib .. && cmake --build . --target install | |
# install dep | |
RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh | |
# get the sample source code from gist | |
WORKDIR /go/src/blog | |
ADD https://gist.githubusercontent.com/ali-ince/baefaf990f7baedadece133520f31310/raw/bc2087227f600d547d4cab80afd2d872f462f1eb/completed.go main.go | |
# install dependencies | |
RUN dep init && dep ensure -add github.com/neo4j/neo4j-go-driver/neo4j | |
# build statically linked executable | |
RUN go build -o sample -tags seabolt_static main.go | |
# base the image to neo4j | |
FROM neo4j:3.4 | |
# copy the statically linked executable | |
COPY --from=dev-build /go/src/blog/sample /blog/sample |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment