Some small cleanup to docs.

This commit is contained in:
Travis Reeder
2017-05-26 18:54:26 +00:00
committed by Reed Allman
parent ed46a61f51
commit 69f0201818
13 changed files with 92 additions and 107 deletions

View File

@@ -1,15 +1,18 @@
# Packaging your Function
## Option 1 (recommended): Use the `fn` cli tool
We recommend using the [fn cli tool](../fn/README.md) which will handle all of this for you. But if you'd like to dig in
and customize your images, look at Option 2.
## Option 2: Build your own images
Packaging a function has two parts:
* Create a Docker image for your function with an ENTRYPOINT
* Push your Docker image to a registry (Docker Hub by default)
Once it's pushed to a registry, you can use it by referencing it when adding a route.
## Using fn
This is the easiest way to build, package and deploy your functions.
Once it's pushed to a registry, you can use the image location when adding a route.
### Creating an image
@@ -17,7 +20,7 @@ The basic Dockerfile for most languages is along these lines:
```
# Choose base image
FROM golang:alpine
FROM funcy/node:dev
# Set the working directory
WORKDIR /function
# Add your binary or code to the working directory
@@ -26,29 +29,16 @@ ADD funcbin /function/
ENTRYPOINT ["./funcbin"]
```
Then you simply build your function:
Then build your function image:
```sh
docker run --rm -v ${pwd}:/go/src/$FUNCPKG -w /go/src/$FUNCPKG funcy/go:dev go build -o funcbin
docker build -t $USERNAME/myfunction .
```
Or using [fn](../fn/README.md):
```sh
fn build
```
### Push your image
This part is simple:
```sh
docker push $USERNAME/myfunction
```
Or using [fn](../fn/README.md):
```sh
fn push
```
Now you can use that image when creating or updating routes.