Skaffold for Fission (#1172)

Skaffold for development of Fission and switching to multi-stage Dockerfile for all components.
This commit is contained in:
Vishal
2019-05-27 12:51:00 +05:30
committed by GitHub
parent c3177f9ebd
commit 49f9944b86
21 changed files with 215 additions and 123 deletions
-3
View File
@@ -1,3 +0,0 @@
FROM alpine:3.4
RUN apk add --update ca-certificates
ADD fission-bundle /
+28
View File
@@ -0,0 +1,28 @@
FROM golang:1.11-alpine as builder
RUN apk add bash ca-certificates git gcc g++ libc-dev
ARG GITCOMMIT=unknown
# E.g. GITCOMMIT=$(git rev-parse HEAD)
ARG BUILDVERSION=unknown
# E.g. BUILDVERSION=$(git rev-parse HEAD)
ARG BUILDDATE=unknown
# E.g. BUILDDATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
ARG GOPKG=github.com/fission/fission
COPY . /go/src/${GOPKG}
RUN rm -f /go/src/${GOPKG}/Dockerfile*
WORKDIR /go/src/${GOPKG}/fission-bundle
ENV GO111MODULE=on
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -mod vendor \
-o /go/bin/fission-bundle \
-gcflags=-trimpath=$GOPATH \
-asmflags=-trimpath=$GOPATH \
-ldflags "-X github.com/fission/fission.GitCommit=${GITCOMMIT} -X github.com/fission/fission.BuildDate=${BUILDDATE} -X github.com/fission/fission.Version=${BUILDVERSION}"
FROM alpine:3.4
RUN apk add --update ca-certificates
COPY --from=builder /go/bin/fission-bundle /
ENTRYPOINT ["/fission-bundle"]
-17
View File
@@ -1,17 +0,0 @@
#!/bin/sh
version=$1
if [ -z $version ]; then
version=$(git rev-parse HEAD)
fi
date=$2
if [ -z $date ]; then
date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
fi
gitcommit=$3
if [ -z $gitcommit ]; then
gitcommit=$(git rev-parse HEAD)
fi
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -gcflags=-trimpath=$GOPATH -asmflags=-trimpath=$GOPATH -ldflags "-X github.com/fission/fission.GitCommit=$gitcommit -X github.com/fission/fission.BuildDate=$date -X github.com/fission/fission.Version=$version"
+8
View File
@@ -1,6 +1,7 @@
package main
import (
"flag"
"fmt"
"log"
"os"
@@ -150,6 +151,13 @@ func registerTraceExporter(logger *zap.Logger, arguments map[string]interface{})
}
func main() {
// From https://github.com/containous/traefik/pull/1817/files
// Tell glog to log into STDERR. Otherwise, we risk
// certain kinds of API errors getting logged into a directory not
// available in a `FROM scratch` Docker container, causing glog to abort
// hard with an exit code > 0.
flag.Set("logtostderr", "true")
usage := `fission-bundle: Package of all fission microservices: controller, router, executor.
Use it to start one or more of the fission servers: