More doc updates, explanation of serverless. (#228)

* More doc updates, explanation of serverless.

* Moved howto directory to examples and some minor doc updates.

* Added apps and routes docs.

* Fixes for Carlos' comments.

* Added bit about importing lambda functions.
This commit is contained in:
Travis Reeder
2016-11-08 09:44:08 -08:00
committed by GitHub
parent 4717889693
commit 85e15fe48a
49 changed files with 282 additions and 99 deletions

50
docs/packaging.md Normal file
View File

@@ -0,0 +1,50 @@
# Packaging your Function
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.
## Creating an image
The basic Dockerfile for most languages is along these lines:
```
# Choose base image
FROM iron/go
# Set the working directory
WORKDIR /function
# Add your binary or code to the working directory
ADD funcbin /function/
# Set what will run when a container is started for this image
ENTRYPOINT ["./funcbin"]
```
Then you simply build your function:
```sh
docker run --rm -v "$PWD":/go/src/$FUNCPKG -w /go/src/$FUNCPKG iron/go:dev go build -o funcbin
docker build -t $USERNAME/myfunction .
```
Or using [fnctl](../fnctl/README.md):
```sh
fnctl build
```
## Push your image
This part is simple:
```sh
docker push $USERNAME/myfunction
```
Or using [fnctl](../fnctl/README.md):
```sh
fnctl push
```