-
Notifications
You must be signed in to change notification settings - Fork 226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
can't load package when building #631
Comments
And... I think I know why:
|
Yes, fn tool is used to build a container which hosts your local function/application. It doesn't really make sense to use a remote docker host with fn build, because your local files will need to be copied there as well. Therefore the recommended way to provision and deploy your function is to use a container registry (Dockerhub, or ECR, or your own). The flow should be something like this :
If you have an idea for an alternative flow, please let us know ! Hmm, thinking about this, (and checking the documentation for docker build) it seems it is possible to specify a git repository. In that case, it should be possible to build via docker remote API if the project is in a repo. |
Hmm ... AFAIK docker build itself copies the contents of the cwd into
what's called a "context", shoves that to the remote api, unpacks it, then
runs the build instructions in the Dockerfile
I feel like fb needs to have the same/similar capability -- either that or
re-use the docker build api somehow?
James Mills / prologic
E: [email protected]
W: prologic.shortcircuit.net.au
…On Wed, Aug 9, 2017 at 11:11 PM, Arda Karaduman ***@***.***> wrote:
Yes, fn tool is used to build a container which hosts your local
function/application.
It doesn't really make sense to use a remote docker host with fn build,
because your local files will need to be copied there as well. Therefore
the recommended way to provision and deploy your function is to use a
container registry (Dockerhub, or ECR, or your own). The flow should be
something like this :
- init & develop in your local
- build
- push the container to some CR
- pull & run at your production node which is running the functions
container (you can do this via docker remote host)
If you have an idea for an alternative flow, please let us know !
Hmm, thinking about this, (and checking the documentation for docker build
<https://docs.docker.com/engine/reference/commandline/build/#usage>) it
seems it is possible to specify a git repository. In that case, it should
be possible to build via docker remote API if the project is in a repo.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#631 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABOv-iSYaZfXK_-2oA4V2830sSNmM2f1ks5sWp74gaJpZM4OsEnW>
.
|
It seems you are right, thank you for the clarification ! Line 95 in d8871d1
The proper solution to this would be to re write
|
I'll try that...
James Mills / prologic
E: [email protected]
W: prologic.shortcircuit.net.au
…On Thu, Aug 10, 2017 at 1:07 AM, Arda Karaduman ***@***.***> wrote:
It seems you are right, thank you for the clarification !
I'm checking the fn source code, it seems fn tool is executing docker as
a shell command.
https://github.com/iron-io/functions/blob/d8871d1562c0e30fcf43f7e02b19a7
06f366eafb/fn/common.go#L95
The proper solution to this would be to re write fn tool using docker
golang bindings, but as a short term solution, I am wondering if you could
get this to work by passing DOCKER_HOST to fn build ? ie
DOCKER_HOST={your docker host here} fn build
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#631 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABOv-nnL3Dn248RgzQo96UzmeLJW7ayzks5sWrpEgaJpZM4OsEnW>
.
|
Yeah that doesn't work I'm afraid :/
I think the main issue is the lack of using the Docker build API itself and sending context (contents of the working directory) up to the remote host as part of the image build. IIUC |
Meanwhile my only work-around is to spin up a Docker machine on my Mac which is unideal as its woefully underpowered :) (tiny 11" Macbook) -- hence the whole reason I have an entire cluster of machiens more grunty! |
Hello again, I've checked into this issue, it seems the problem is with https://github.com/iron-io/functions/blob/master/fn/langs/go.go#L29 which tries to mount your local dir to the remote host via the which doesn't work. As a work-around, you can create your own Dockerfile, which would prevent this prebuild step. I'm linking an example project which has a known working Dockerfile for remote building. https://bitbucket.org/coze/query/src/dff81a3ab0a39f1c586efe394a377a382065ed0d/?at=custom-dockerfile This one uses glide for dependency management, but feel free to use another one if you like. PS: you also need the .dockerignore to prevent your local vendor directory being copied over to the host. |
I see! I'll check this out and report back.
Do we still want to keep this issue open to track making appropriate
changes to the build step so it doesn't assume a local Docker engine?
James Mills / prologic
E: [email protected]
W: prologic.shortcircuit.net.au
…On Mon, Aug 14, 2017 at 3:20 AM, Arda Karaduman ***@***.***> wrote:
Hello again,
I've checked into this issue, it seems the problem is with
https://github.com/iron-io/functions/blob/master/fn/langs/go.go#L29
which tries to mount your local dir to the remote host via the -v flag.
moby/moby#4023 <moby/moby#4023>
which doesn't work. As a work-around, you can create your own Dockerfile,
which would prevent this prebuild step.
I'm linking an example project which has a known working Dockerfile for
remote building.
https://bitbucket.org/coze/query/src/dff81a3ab0a39f1c586efe394a377a
382065ed0d/?at=custom-dockerfile
This one uses glide <https://glide.sh/> for dependency management, but
feel free to use another one if you like.
PS: you also need the .dockerignore to prevent your local vendor directory
being copied over to the host.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#631 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABOv-oNoudybU6P6bLtivgh-8HVF2VJeks5sYB9ugaJpZM4OsEnW>
.
|
I created a new issue for that. Please close this one if the Dockerfile solves your problem. |
Seems to work:
Contents of
|
I believe it did. Closing... |
Pretty much followed the README, created a directory, copied the sample.
The text was updated successfully, but these errors were encountered: