Skip to content

Commit

Permalink
Post-merge fixes
Browse files Browse the repository at this point in the history
* Reinstate Windows build
* Mention Dockerfile --lang type in help
* Validate that "lang" is passed in YAML
* Add vendoring packages for Windows

Signed-off-by: Alex Ellis <[email protected]>
  • Loading branch information
alexellis committed Aug 31, 2017
1 parent 706761e commit b877c56
Show file tree
Hide file tree
Showing 9 changed files with 211 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ faas-cli
!contrib/bash/faas-cli
faas-cli-darwin
faas-cli-armhf
faas-cli.exe

*.jpg
*.pyc
Expand Down
14 changes: 8 additions & 6 deletions Dockerfile.redist
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@ COPY . .
RUN go get -d -v

RUN GIT_COMMIT=$(git rev-list -1 HEAD) \
&& GOARCH=arm GOARM=6 CGO_ENABLED=0 GOOS=linux go build --ldflags "-X main.GitCommit=${GIT_COMMIT}" -a -installsuffix cgo -o faas-cli-armhf . \
&& CGO_ENABLED=0 GOOS=darwin go build --ldflags "-X main.GitCommit=${GIT_COMMIT}" -a -installsuffix cgo -o faas-cli-darwin \
&& CGO_ENABLED=0 GOOS=linux go build --ldflags "-X main.GitCommit=${GIT_COMMIT}" -a -installsuffix cgo -o faas-cli .
&& GOARCH=arm GOARM=6 CGO_ENABLED=0 GOOS=linux go build --ldflags "-X commands.GitCommit=${GIT_COMMIT}" -a -installsuffix cgo -o faas-cli-armhf \
&& CGO_ENABLED=0 GOOS=darwin go build --ldflags "-X commands.GitCommit=${GIT_COMMIT}" -a -installsuffix cgo -o faas-cli-darwin \
&& CGO_ENABLED=0 GOOS=linux go build --ldflags "-X commands.GitCommit=${GIT_COMMIT}" -a -installsuffix cgo -o faas-cli \
&& CGO_ENABLED=0 GOOS=windows go build --ldflags "-X commands.GitCommit=${GIT_COMMIT}" -a -installsuffix cgo -o faas-cli.exe

FROM alpine:latest
RUN apk --no-cache add ca-certificates

WORKDIR /root/

COPY --from=0 /go/src/github.com/alexellis/faas-cli/faas-cli .
COPY --from=0 /go/src/github.com/alexellis/faas-cli/faas-cli-darwin .
COPY --from=0 /go/src/github.com/alexellis/faas-cli/faas-cli-armhf .
COPY --from=0 /go/src/github.com/alexellis/faas-cli/faas-cli .
COPY --from=0 /go/src/github.com/alexellis/faas-cli/faas-cli-darwin .
COPY --from=0 /go/src/github.com/alexellis/faas-cli/faas-cli-armhf .
COPY --from=0 /go/src/github.com/alexellis/faas-cli/faas-cli.exe .

CMD ["./faas"]
1 change: 1 addition & 0 deletions build_redist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ docker build --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_p
docker cp faas-cli:/root/faas-cli . && \
docker cp faas-cli:/root/faas-cli-darwin . && \
docker cp faas-cli:/root/faas-cli-armhf . && \
docker cp faas-cli:/root/faas-cli.exe . && \
docker rm -f faas-cli
7 changes: 6 additions & 1 deletion commands/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var buildCmd = &cobra.Command{
faas-cli build --image IMAGE_NAME
--handler HANDLER_DIR
--name FUNCTION_NAME
[--lang <ruby|python|python-armf|node|node-armf|csharp>]
[--lang <ruby|python|python-armf|node|node-armf|csharp|Dockerfile>]
[--no-cache] [--squash]`,
Short: "Builds OpenFaaS function containers",
Long: `Builds OpenFaaS function containers either via the supplied YAML config using
Expand Down Expand Up @@ -83,6 +83,11 @@ func runBuild(cmd *cobra.Command, args []string) {
function.Name = k
// fmt.Println(k, function)
fmt.Printf("Building: %s.\n", function.Name)
if len(function.Language) == 0 {
fmt.Println("Please provide a valid -lang or 'Dockerfile' for your function.")
return
}

builder.BuildImage(function.Image, function.Handler, function.Name, function.Language, nocache, squash)
}
}
Expand Down
13 changes: 13 additions & 0 deletions vendor/github.com/inconshreveable/mousetrap/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions vendor/github.com/inconshreveable/mousetrap/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions vendor/github.com/inconshreveable/mousetrap/trap_others.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

98 changes: 98 additions & 0 deletions vendor/github.com/inconshreveable/mousetrap/trap_windows.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 46 additions & 0 deletions vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b877c56

Please sign in to comment.