Skip to content

Commit 16f6dc1

Browse files
chore: run go build in docker
1 parent 9b6d5bf commit 16f6dc1

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

Dockerfile

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
1-
# Obtain latest ca-certificates
2-
FROM alpine:latest as certs
3-
RUN apk --update add ca-certificates
1+
FROM golang:alpine AS builder
2+
ARG VERSION
3+
4+
RUN apk update && apk add --no-cache git ca-certificates && update-ca-certificates
5+
6+
WORKDIR $GOPATH/src/semantic-release
7+
COPY . .
8+
9+
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a --installsuffix cgo -ldflags="-extldflags \'-static\' -s -w -X main.SRVERSION=$VERSION" -o /go/bin/semantic-release ./cmd/semantic-release/
10+
411

512
FROM scratch
6-
ADD out/semantic-release /usr/local/bin/release
7-
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
8-
CMD ["release"]
13+
14+
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
15+
COPY --from=builder /go/bin/semantic-release /
16+
17+
ENTRYPOINT ["/semantic-release"]

0 commit comments

Comments
 (0)