Skip to content

Commit 218d94b

Browse files
committed
Dockerfile improvements
1 parent 654ea40 commit 218d94b

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ RUN apk add --update git
66
WORKDIR /go/src/github.com/friendsofgo/graphiql
77
COPY . .
88
RUN TAG=$(git describe --tags --abbrev=0) \
9-
&& LDFLAGS=$(echo "-s -X main.version="$TAG) \
10-
&& go build -o /go/bin/graphiql -ldflags "$LDFLAGS" cmd/graphiql/main.go
9+
&& LDFLAGS=$(echo "-s -w -X main.version="$TAG) \
10+
&& CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o /go/bin/graphiql -ldflags "$LDFLAGS" cmd/graphiql/main.go
1111

1212
# Building image with the binary
13-
FROM alpine
14-
COPY --from=build /go/bin/graphiql /bin/
15-
ENTRYPOINT ["graphiql"]
13+
FROM scratch
14+
COPY --from=build /go/bin/graphiql /go/bin/graphiql
15+
ENTRYPOINT ["/go/bin/graphiql"]

0 commit comments

Comments
 (0)