Specify full golang version in Dockerfiles and build helper script (#227)
Addresses #222. Plugins and the binaries loading them need to be built with the exact same go version. Also update README instructions.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
FROM golang:1.8
|
FROM golang:1.8.1
|
||||||
|
|
||||||
ENV GOPATH /usr
|
ENV GOPATH /usr
|
||||||
ENV APP ${GOPATH}/src/github.com/fission/fission/environments/go
|
ENV APP ${GOPATH}/src/github.com/fission/fission/environments/go
|
||||||
|
|||||||
@@ -10,6 +10,13 @@ It's a Docker image containing a Go 1.8 runtime, along with a dynamic loader.
|
|||||||
docker build -t USER/go-runtime . && docker push USER/go-runtime
|
docker build -t USER/go-runtime . && docker push USER/go-runtime
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note that if you build the runtime, you must also build the go-builder
|
||||||
|
image, to ensure that it's at the same version of go:
|
||||||
|
|
||||||
|
```
|
||||||
|
cd builder && docker build -t USER/go-builder . && docker push USER/go-builder
|
||||||
|
```
|
||||||
|
|
||||||
## Using the image in fission
|
## Using the image in fission
|
||||||
|
|
||||||
You can add this customized image to fission with "fission env
|
You can add this customized image to fission with "fission env
|
||||||
@@ -28,7 +35,6 @@ fission env update --name go-runtime --image USER/go-runtime
|
|||||||
After this, fission functions that have the env parameter set to the
|
After this, fission functions that have the env parameter set to the
|
||||||
same environment name as this command will use this environment.
|
same environment name as this command will use this environment.
|
||||||
|
|
||||||
|
|
||||||
## Creating functions to use this image
|
## Creating functions to use this image
|
||||||
|
|
||||||
See the [examples README](examples/go/README.md).
|
See the [examples README](examples/go/README.md).
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM golang:1.8
|
FROM golang:1.8.1
|
||||||
|
|
||||||
ENV GOPATH /usr
|
ENV GOPATH /usr
|
||||||
RUN go get github.com/fission/fission
|
RUN go get github.com/fission/fission
|
||||||
|
|||||||
@@ -8,4 +8,4 @@ else
|
|||||||
filename=$1
|
filename=$1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker run --rm -v $(pwd):/build -w /build fission/go-builder go build -buildmode=plugin -o function.so $filename && echo "Compiled plugin: function.so. Use 'fission function create' to upload to fission."
|
docker run --rm -v $(pwd):/build -w /build fission/go-builder:1.8.1 go build -buildmode=plugin -o function.so $filename && echo "Compiled plugin: function.so. Use 'fission function create' to upload to fission."
|
||||||
|
|||||||
+14
-8
@@ -4,22 +4,28 @@ The `go` runtime uses the [`plugin` package](https://golang.org/pkg/plugin/) to
|
|||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
First, [set up your fission deployment with the go environment](https://github.com/fission/fission/blob/master/environments/go/README.md).
|
First, set up your fission deployment with the go environment.
|
||||||
|
|
||||||
To use this environment, download the [build helper
|
```
|
||||||
script](https://raw.githubusercontent.com/fission/fission/master/environments/go/builder/go-function-build).
|
fission env create --name go-env --image fission/go-env:1.8.1
|
||||||
|
```
|
||||||
|
|
||||||
The script must be run in the same directory as the function you're
|
To ensure that you build functions using the same version as the
|
||||||
building.
|
runtime, fission provides a docker image and helper script for
|
||||||
|
building functions.
|
||||||
|
|
||||||
## Examples
|
## Example Usage
|
||||||
|
|
||||||
### hello.go
|
### hello.go
|
||||||
|
|
||||||
`hello.go` is an very basic HTTP handler returning `"Hello, World!"`.
|
`hello.go` is an very basic HTTP handler returning `"Hello, World!"`.
|
||||||
|
|
||||||
```
|
```bash
|
||||||
# Build the function as a plugin. Outputs result to 'function.so'.
|
# Download the build helper script
|
||||||
|
$ curl https://raw.githubusercontent.com/fission/fission/master/environments/go/builder/go-function-build > go-function-build
|
||||||
|
$ chmod +x go-function-build
|
||||||
|
|
||||||
|
# Build the function as a plugin. Outputs result to 'function.so'
|
||||||
$ go-function-build hello.go
|
$ go-function-build hello.go
|
||||||
|
|
||||||
# Upload the function to fission
|
# Upload the function to fission
|
||||||
|
|||||||
Reference in New Issue
Block a user