-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
77d3bc5
commit 5bbae15
Showing
1 changed file
with
7 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
# Build stage | ||
FROM golang AS build-env | ||
FROM golang:1.18-alpine As build-env | ||
|
||
RUN mkdir /src | ||
WORKDIR /src | ||
COPY go.mod . | ||
COPY go.sum . | ||
|
||
# Get dependancies - will also be cached if we won't change mod/sum | ||
RUN go mod download | ||
|
||
# COPY the source code as the last step | ||
COPY . . | ||
|
||
RUN go mod download google.golang.org/grpc/cmd/protoc-gen-go-grpc | ||
RUN go get github.com/grpc-ecosystem/grpc-gateway/v2/[email protected] | ||
|
||
RUN apk add make | ||
RUN make install | ||
RUN make generate | ||
|
||
ENV CGO_ENABLED=0 | ||
ENV GOOS=linux | ||
ENV GOARCH=amd64 | ||
RUN go build -a -installsuffix cgo -o /api | ||
|
||
# Production stage | ||
FROM scratch | ||
# # Production stage | ||
FROM golang:1.18-alpine | ||
COPY --from=build-env /api / | ||
|
||
EXPOSE 10000 | ||
|