diff --git a/Dockerfile b/Dockerfile index bbd756e63..4ecbfc962 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,24 +1,12 @@ -FROM fnproject/dind -RUN apk add --no-cache ca-certificates build-base go git bzr mercurial gcc - -ENV GOPATH=/go -RUN env -ENV PATH=$PATH:/go/bin -RUN env +# build stage +FROM golang:alpine AS build-env +RUN apk --no-cache add build-base git bzr mercurial gcc ENV D=/go/src/github.com/fnproject/fn - ADD . $D -RUN cd $D && go build -o /app/functions +RUN cd $D && go build -o fn-alpine && cp fn-alpine /tmp/ +# final stage +FROM fnproject/dind WORKDIR /app +COPY --from=build-env /tmp/fn-alpine /app/functions CMD ["./functions"] - -# For building extensions -ONBUILD ENV REPOPATH=$GOPATH/src/github.com/x/y -ONBUILD ADD . $REPOPATH -# note: It might be a good idea to move interfaces and models to a new repo with minimal dependencies, then doing a dep ensure/install might work nice -# ONBUILD RUN go get -u github.com/golang/dep/cmd/dep -# ONBUILD RUN cd $REPOPATH && dep init && dep ensure -# Try doing regular go get: -ONBUILD RUN cd $REPOPATH && go get -ONBUILD RUN cd $REPOPATH && go build -o /app/functions diff --git a/docs/operating/options.md b/docs/operating/options.md index 3077f4979..cfb60d056 100644 --- a/docs/operating/options.md +++ b/docs/operating/options.md @@ -1,5 +1,15 @@ # Fn Runtime Options +## Default run command for production + +This will run with docker in docker. + +```sh +docker run --privileged --rm --name fns -it -v $PWD/data:/app/data -p 80:8080 fnproject/functions +``` + +See below for starting without docker in docker. + ## Configuration When starting Fn, you can pass in the following configuration variables as environment variables. Use `-e VAR_NAME=VALUE` in