-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
6 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,18 @@ | ||
################################## | ||
# STEP 1 build executable binary # | ||
################################## | ||
|
||
FROM golang:alpine AS builder | ||
|
||
# Install git. | ||
# Git is required for fetching the dependencies. | ||
RUN apk update && apk add --no-cache git ca-certificates && update-ca-certificates | ||
WORKDIR $GOPATH/src/ | ||
|
||
# Set version var | ||
ARG APP_VERSION | ||
|
||
# Clone the branch for the given version | ||
RUN git clone --depth 1 --branch ${APP_VERSION} https://github.com/bojand/ghz | ||
WORKDIR $GOPATH/src/ghz/cmd/ghz | ||
|
||
# Fetch dependencies using go get. | ||
RUN go get -d -v | ||
|
||
# Build the binary. | ||
RUN CGO_ENABLED=0 go build -o /go/bin/ghz | ||
|
||
############################## | ||
# STEP 2 build a small image # | ||
############################## | ||
RUN apk update && apk add --no-cache git ca-certificates && update-ca-certificates | ||
RUN go install github.com/bojand/ghz/cmd/ghz@${APP_VERSION} | ||
|
||
FROM alpine | ||
RUN apk update && apk add --no-cache httpie ca-certificates && update-ca-certificates | ||
|
||
# Import from the builder image. | ||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
|
||
# Copy our static executable from the builder image. | ||
COPY --from=builder /go/bin/ghz /go/bin/ghz | ||
|
||
# Create directories | ||
RUN mkdir -p /ghz/protos | ||
|
||
# Copy our entrypoint script | ||
COPY entrypoint.sh . | ||
|
||
# Change its owner | ||
RUN mkdir -p /ghz/protos | ||
RUN chmod +x entrypoint.sh | ||
|
||
# Set it as entrypoint | ||
ENTRYPOINT ["./entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters