Last active
June 10, 2019 22:10
-
-
Save Harsimran1/3cc0982c1bb7fcda7448d156757ab792 to your computer and use it in GitHub Desktop.
Dockerfiles
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
# Accept the Go version for the image to be set as a build argument. | |
# Default to Go 1.12 | |
ARG GO_VERSION=1.12 | |
FROM golang:${GO_VERSION} | |
# Set the environment variables for the commands passed to the stage when using | |
# `docker build --target code`. Leave CGO available for the race detector. | |
# Set the working directory outside $GOPATH to enable the support for modules. | |
WORKDIR /app | |
# Import the code from the context. | |
COPY ./ ./ | |
# Set the environment variables for the build command. | |
ENV CGO_ENABLED=1 GOFLAGS=-mod=vendor | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
libssl-dev | |
ENV GOOS=linux GOARCH=amd64 | |
RUN ls | |
RUN go build -o ./cmd/grpc/grpc ./cmd/grpc | |
ENTRYPOINT ./cmd/grpc/grpc |
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
# Accept the Go version for the image to be set as a build argument. | |
# Default to Go 1.12 | |
ARG GO_VERSION=1.12 | |
FROM golang:${GO_VERSION} | |
# Set the environment variables for the build command. | |
ENV CGO_ENABLED=1 GOFLAGS=-mod=vendor GOOS=linux GOARCH=amd64 | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
libssl-dev | |
# Set the working directory outside $GOPATH to enable the support for modules. | |
WORKDIR /app | |
# Import the code from the context. | |
COPY ./ ./ | |
RUN go build -o ./cmd/grpc/grpc ./cmd/grpc | |
ENTRYPOINT ./cmd/grpc/grpc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment