diff --git a/Dockerfile b/Dockerfile index 99c37b66e..dde955282 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM golang:1.10-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 fn-alpine && cp fn-alpine /tmp/ +RUN cd $D/cmd/fnserver && go build -o fn-alpine && cp fn-alpine /tmp/ # final stage: the local fnproject/dind:latest will be either built afresh or # whatever is the latest from master, depending on whether we're releasing diff --git a/Makefile b/Makefile index 08409886b..08930f346 100644 --- a/Makefile +++ b/Makefile @@ -8,10 +8,10 @@ dep-up: dep ensure build: api/agent/grpc/runner.pb.go - go build -o fnserver + go build -o fnserver ./cmd/fnserver install: - go build -o ${GOPATH}/bin/fnserver + go build -o ${GOPATH}/bin/fnserver ./cmd/fnserver checkfmt: ./go-fmt.sh diff --git a/build.ps1 b/build.ps1 index e9733f125..526eb2e8a 100644 --- a/build.ps1 +++ b/build.ps1 @@ -21,7 +21,7 @@ function quick() { } function build () { - docker run --rm -v ${pwd}:/go/src/github.com/fnproject/fn -w /go/src/github.com/fnproject/fn golang:alpine go build -o fn-alpine + docker run --rm -v ${pwd}:/go/src/github.com/fnproject/fn -w /go/src/github.com/fnproject/fn/cmd/fnserver golang:alpine go build -o fn-alpine docker build -t fnproject/fnserver:latest . function run () { diff --git a/main.go b/cmd/fnserver/main.go similarity index 100% rename from main.go rename to cmd/fnserver/main.go diff --git a/examples/extensions/README.md b/examples/extensions/README.md index a982553f8..8d3ef2773 100644 --- a/examples/extensions/README.md +++ b/examples/extensions/README.md @@ -1,6 +1,6 @@ # Extensions Example -This example adds extra endpoints to the API. See [main.go](main.go) for example code. +This example adds extra endpoints to the API. See [main.go](main.go) for example code. ## Building and Running diff --git a/images/api/Dockerfile b/images/api/Dockerfile index b3d3f0078..468bd1099 100644 --- a/images/api/Dockerfile +++ b/images/api/Dockerfile @@ -3,7 +3,7 @@ FROM golang:1.10-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 fn-alpine && cp fn-alpine /tmp/ +RUN cd $D/cmd/fnserver && go build -o fn-alpine && cp fn-alpine /tmp/ # final stage: the local fnproject/dind:latest will be either built afresh or # whatever is the latest from master, depending on whether we're releasing diff --git a/images/lb/Dockerfile b/images/lb/Dockerfile index 57ddca87e..5d8b3bf81 100644 --- a/images/lb/Dockerfile +++ b/images/lb/Dockerfile @@ -3,7 +3,7 @@ FROM golang:1.10-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 fn-alpine && cp fn-alpine /tmp/ +RUN cd $D/cmd/fnserver && go build -o fn-alpine && cp fn-alpine /tmp/ # final stage: the local fnproject/dind:latest will be either built afresh or # whatever is the latest from master, depending on whether we're releasing diff --git a/images/runner/Dockerfile b/images/runner/Dockerfile index 6d512e4d8..951382723 100644 --- a/images/runner/Dockerfile +++ b/images/runner/Dockerfile @@ -3,7 +3,7 @@ FROM golang:1.10-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 fn-alpine && cp fn-alpine /tmp/ +RUN cd $D/cmd/fnserver && go build -o fn-alpine && cp fn-alpine /tmp/ # final stage: the local fnproject/dind:latest will be either built afresh or # whatever is the latest from master, depending on whether we're releasing