Creating a Docker image of our CNN

Pachyderm data pipelines are dependent on prebaked Docker images. The internet is full of Docker tutorials, so we'll keep things simple here and discuss what we need to do to take advantage of the simple deployment steps for any Go application.

Let's take a look at our Dockerfile:

FROM golang:1.12

ADD main.go /main.go

ADD cifar/ /cifar/

RUN export GOPATH=$HOME/go && cd / && go get -d -v .

And that's it! We're simply fetching the Go 1.12 image from Docker Hub and dropping our CIFAR CNN into our build. The final piece of our Dockerfile is a command to set GOPATH and meet our dependencies (for example, installing Gorgonia).

Execute the following command to build the Docker image and observe the output: docker build -t cifarcnn:

Sending build context to Docker daemon 212.6MB
Step 1/4 : FROM golang:1.12
---> 9fe4cdc1f173
Step 2/4 : ADD main.go /main.go
---> Using cache
---> 5edf0df312f4
Step 3/4 : ADD cifar/ /cifar/
---> Using cache
---> 6928f37167a8
Step 4/4 : RUN export GOPATH=$HOME/go && cd / && go get -d -v .
---> Running in 7ff14ada5e7c
Fetching https://gorgonia.org/tensor?go-get=1
Parsing meta tags from https://gorgonia.org/tensor?go-get=1 (status code 200)
get "gorgonia.org/tensor": found meta tag get.metaImport{Prefix:"gorgonia.org/tensor", VCS:"git", RepoRoot:"https://github.com/gorgonia/tensor"} at https://gorgonia.org/tensor?go-get=1

...

Fetching https://gorgonia.org/dawson?go-get=1
Parsing meta tags from https://gorgonia.org/dawson?go-get=1 (status code 200)
get "gorgonia.org/dawson": found meta tag get.metaImport{Prefix:"gorgonia.org/dawson", VCS:"git", RepoRoot:"https://github.com/gorgonia/dawson"} at https://gorgonia.org/dawson?go-get=1
gorgonia.org/dawson (download)
Removing intermediate container 7ff14ada5e7c
---> 3def2cada165
Successfully built 3def2cada165
Successfully tagged cifar_cnn:latest

Our container is now ready to be referenced in the Pachyderm data pipeline specification.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.98.250