cloudfoundry-samples / lattice-app

A Demo Application for Lattice
Apache License 2.0
6 stars 22 forks source link

Distributes as docker image; but still requires local golang setup #4

Closed drnic closed 9 years ago

drnic commented 9 years ago

This is the first application built for lattice; so tried to look at its build system to create the docker image used in lattice examples.

As per instructions I cloned the repo somewhere and I ran:

./build.sh

This fails with:

Compiling for linux...
main.go:9:2: cannot find package "github.com/pivotal-cf-experimental/lattice-app/handlers" in any of:
    /usr/local/go/src/github.com/pivotal-cf-experimental/lattice-app/handlers (from $GOROOT)
    /Users/drnic/Projects/go/src/github.com/pivotal-cf-experimental/lattice-app/handlers (from $GOPATH)
main.go:10:2: cannot find package "github.com/pivotal-cf-experimental/lattice-app/helpers" in any of:
    /usr/local/go/src/github.com/pivotal-cf-experimental/lattice-app/helpers (from $GOROOT)
    /Users/drnic/Projects/go/src/github.com/pivotal-cf-experimental/lattice-app/helpers (from $GOPATH)
main.go:11:2: cannot find package "github.com/pivotal-cf-experimental/lattice-app/routes" in any of:
    /usr/local/go/src/github.com/pivotal-cf-experimental/lattice-app/routes (from $GOROOT)
    /Users/drnic/Projects/go/src/github.com/pivotal-cf-experimental/lattice-app/routes (from $GOPATH)
Constructing Dockerimage
^C^CCleaning up...

Ahh, so its a golang app.

Now I have to do golang things first? Not ./build.sh?

$ go get ./...
go install: no install location for directory /Users/drnic/Projects/lattice/apps/lattice-app outside GOPATH
go install: no install location for directory /Users/drnic/Projects/lattice/apps/lattice-app/handlers outside GOPATH
go install: no install location for directory /Users/drnic/Projects/lattice/apps/lattice-app/helpers outside GOPATH
go install: no install location for directory /Users/drnic/Projects/lattice/apps/lattice-app/routes outside GOPATH

So I have to move my lattice app out of my folder of lattice apps and into my $GOPATH?

Thought: if the assumption is that user has lattice and possible direct access to docker - could ./build.sh use lattice/docker and a golang container to compile the app? Would this become a more homogenous experience for "building lattice apps"?

cf-gitbot commented 9 years ago

We have created an issue in Pivotal Tracker to manage this. You can view the current status of your issue at: https://www.pivotaltracker.com/story/show/90698804.

drnic commented 9 years ago

This pattern - build a linux verison on a host machine, then pack it into a docker image, will be much much harder to reproduce for other application languages.

If we're not going to build/compile the app in the final Dockerfile, then perhaps a different Dockerfile could be used for compilation/staging to produce production asset. Then the existing Dockerfile becomes to one that packages those assets into a production Docker image.

onsi commented 9 years ago

:) @drnic

Lattice-App is not intended to be an exemplar of constructing dockerimages.

Here's the essence of the thing you are running into: you want buildpacks. You want buildpacks that can take your source code andconstruct artifacts that can be run on a platform. ;)

This is something Docker does not offer a lot of help with.

It's something we want to explore building a light-weight version of in Lattice. That is likely going to be our next priority -- stay tuned...

Until then - Lattice runs Dockerimages but does not help you construct those Dockerimages.

menicosia commented 9 years ago

Hiya @drnic,

I came across this issue while scrubbing our backlog. I think we all agree that building docker images is a pain, but doing the full run of how to do that is not necessary for lattice-app documentation. Especially now that the team has started work on the 'condenser' epic (buildpacks -> droplets), I'm going to close this issue as not a bug. As always, feel free to re-open if you think anything is lost by my doing so.

[edit, I meant to provide the link to the condenser epic]

Marco Nicosia Product Manager Pivotal Software, Inc.