制作Docker生产镜像/Golang+Java+TensorFlow算法引擎
Posted SuperAvalon
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了制作Docker生产镜像/Golang+Java+TensorFlow算法引擎相关的知识,希望对你有一定的参考价值。
背景
基于golang编程语言+TensorFlow算法引擎开发的特征服务,部署至k8s容器平台,
需要单独制作Docker基础镜像
Dockerfile主要编译命令
ENV GO_VERSION 1.13
ENV GOPROXY "https://goproxy.cn,https://goproxy.io,https://mirrors.aliyun.com/goproxy/,direct"
#jdk11
RUN wget https://download.java.net/openjdk/jdk11/ri/openjdk-11+28_linux-x64_bin.tar.gz \\
&& tar -C /usr/local -xzf openjdk-11+28_linux-x64_bin.tar.gz \\
&& echo -e "export JAVA_HOME=/usr/local/jdk-11\\nexport CLASSPATH=$JAVA_HOME/lib:$CLASSPATH\\nexport PATH=$JAVA_HOME/bin:$PATH" > .bash_profile \\
&& source .bash_profile
#hadoop
RUN wget https://dlcdn.apache.org/hadoop/common/hadoop-2.10.2/hadoop-2.10.2.tar.gz \\
&& tar -C /usr/local -zxvf hadoop-2.10.2.tar.gz \\
&& rm -f hadoop-2.10.2.tar.gz \\
&& sudo ln -svf /usr/local/hadoop-2.10.1/bin/hadoop /usr/bin/hadoop
#tensorflow
RUN wget https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-1.15.0.tar.gz \\
&& tar -C /usr/local -xzf libtensorflow-cpu-linux-x86_64-1.15.0.tar.gz \\
&& ln -svf /usr/local/lib/libtensorflow_framework.so.1.15.0 /usr/local/lib/libtensorflow_framework.so \\
&& ln -svf /usr/local/lib/libtensorflow_framework.so.1.15.0 /usr/local/lib/libtensorflow_framework.so.1 \\
&& ln -svf /usr/local/lib/libtensorflow.so.1.15.0 /usr/local/lib/libtensorflow.so \\
&& ln -svf /usr/local/lib/libtensorflow.so.1.15.0 /usr/local/lib/libtensorflow.so.1 \\
&& rm -f libtensorflow-cpu-linux-x86_64-1.15.0.tar.gz \\
&& echo -e "export LIBRARY_PATH=\\$LIBRARY_PATH:/usr/local/lib\\nexport LD_LIBRARY_PATH=\\$LD_LIBRARY_PATH:/usr/local/lib" > /etc/profile.d/tf.sh
#golang1.13
RUN wget -nv https://studygolang.com/dl/golang/go$GO_VERSION.linux-amd64.tar.gz \\
&& tar -C /usr/local -xzf go$GO_VERSION.linux-amd64.tar.gz \\
&& rm -f go$GO_VERSION.linux-amd64.tar.gz
USER work
ENV GOROOT="/usr/local/go"
ENV GOPATH="/home/work/go"
ENV GOBIN="$GOPATH/bin"
ENV PATH="$PATH:$GOROOT/bin:$GOBIN:/home/work/bin"
RUN mkdir -p /home/work/bin /home/work/go/pkg /home/work/go/src /home/work/go/bin \\
&& curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /home/work/bin v1.37.0 \\
&& golangci-lint --version
以上是关于制作Docker生产镜像/Golang+Java+TensorFlow算法引擎的主要内容,如果未能解决你的问题,请参考以下文章
47-Docker-Dockerfile镜像创建自动化生产案例