Skip to content

Commit e3d205e

Browse files
committed
Optimize build speed
Removing -a means the template can use a cache and doesn't need to rebuild the image every time. This is much quicker. Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
1 parent e490943 commit e3d205e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

template/golang-http/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} GOFLAGS=${GOFLAGS} go test ./... -cove
3535

3636
WORKDIR /go/src/handler
3737
RUN CGO_ENABLED=${CGO_ENABLED} GOOS=${TARGETOS} GOARCH=${TARGETARCH} GOFLAGS=${GOFLAGS} \
38-
go build --ldflags "-s -w" -a -installsuffix cgo -o handler .
38+
go build --ldflags "-s -w" -o handler .
3939

40-
FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine:3.17.1 as ship
40+
FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine:3.17.2 as ship
4141
# Add non root user and certs
4242

4343
RUN apk --no-cache add ca-certificates \

template/golang-middleware/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go test ./... -cover
3232

3333
WORKDIR /go/src/handler
3434
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
35-
go build --ldflags "-s -w" -a -installsuffix cgo -o handler .
35+
go build --ldflags "-s -w" -o handler .
3636

37-
FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine:3.17.1 as ship
37+
FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine:3.17.2 as ship
3838

3939
# Add non root user and certs
4040
RUN apk --no-cache add ca-certificates \

0 commit comments

Comments
 (0)