Last active
April 3, 2017 11:39
-
-
Save oivoodoo/0e39d25d04025c4f0506d405f83d7126 to your computer and use it in GitHub Desktop.
Go files to build jar file
This file contains hidden or 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
FROM golang:latest | |
RUN apt-get install -y git | |
RUN ln -fsn /usr/local/go/bin/go /usr/local/bin/go | |
RUN cd /tmp/ && wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-x64.tar.gz && \ | |
tar -zxf jdk-8u5-linux-x64.tar.gz && mv jdk1.8.0_05 /opt/ | |
RUN update-alternatives --install /usr/bin/java java /opt/jdk1.8.0_05/bin/java 100 | |
RUN update-alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_05/bin/javac 100 | |
ENV JAVA_VERSION 8 | |
ENV JAVA_HOME /opt/jdk1.8.0_05 | |
ENV MAVEN_VERSION 3.3.9 | |
ENV MAVEN_HOME /usr/share/maven | |
ENV PATH "$PATH:$MAVEN_HOME/bin" | |
# install maven | |
RUN cd /tmp/ && wget http://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz && \ | |
tar -xzf /tmp/apache-maven-$MAVEN_VERSION-bin.tar.gz && \ | |
mv /tmp/apache-maven-$MAVEN_VERSION /usr/share/maven && \ | |
ln -s /usr/share/maven/bin/mvn /usr/bin/mvn |
This file contains hidden or 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
NAME = example | |
build: | |
docker build -t $(NAME) . | |
.PHONY: build | |
release: build | |
docker run --rm -t -i \ | |
-e "GOPATH=/go" \ | |
-e "JAVA_HOME=/opt/jdk1.8.0_05" \ | |
-v $(GOPATH):/go \ | |
-v `pwd`/../../:`pwd`/../../ \ | |
$(NAME) \ | |
/bin/bash \ | |
-c "export PATH=/usr/local/bin:\$$PATH && go get -u github.com/sridharv/gojava && gojava -v -o `pwd`/libparam.jar build github.com/example/udf-example/param" | |
.PHONY: release | |
test: | |
go test -v github.com/example/udf-example/param/ | |
.PHONY: test | |
console: build | |
docker run --rm -t -i \ | |
-e "GOPATH=/go" \ | |
-e "JAVA_HOME=/opt/jdk1.8.0_05" \ | |
-v $(GOPATH):/go \ | |
-v `pwd`/../../:`pwd`/../../ \ | |
$(NAME) \ | |
/bin/bash \ | |
-c "export PATH=/usr/local/bin:\$$PATH && /bin/bash" | |
.PHONY: console |
This file contains hidden or 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
package param | |
func Evaluate(param string) string { | |
return param | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment