Rollback dockerfile (image too big) and add docker run command to docs. (#488)

This commit is contained in:
Travis Reeder
2017-11-09 16:12:45 +01:00
committed by Reed Allman
parent fde2173087
commit 6c21103057
2 changed files with 17 additions and 19 deletions

View File

@@ -1,24 +1,12 @@
FROM fnproject/dind # build stage
RUN apk add --no-cache ca-certificates build-base go git bzr mercurial gcc FROM golang:alpine AS build-env
RUN apk --no-cache add build-base git bzr mercurial gcc
ENV GOPATH=/go
RUN env
ENV PATH=$PATH:/go/bin
RUN env
ENV D=/go/src/github.com/fnproject/fn ENV D=/go/src/github.com/fnproject/fn
ADD . $D 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 WORKDIR /app
COPY --from=build-env /tmp/fn-alpine /app/functions
CMD ["./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

View File

@@ -1,5 +1,15 @@
# Fn Runtime Options # 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 ## Configuration
When starting Fn, you can pass in the following configuration variables as environment variables. Use `-e VAR_NAME=VALUE` in When starting Fn, you can pass in the following configuration variables as environment variables. Use `-e VAR_NAME=VALUE` in