-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modified the docker file to build properly
- Loading branch information
Brandon Phillips
committed
Apr 17, 2020
1 parent
24d057c
commit f874f44
Showing
1 changed file
with
10 additions
and
10 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,22 +1,22 @@ | ||
FROM golang:alpine | ||
|
||
# Set necessary environmet variables needed for our image | ||
ENV GO111MODULE=on \ | ||
ENV GO111MODULE=auto \ | ||
CGO_ENABLED=0 \ | ||
GOOS=linux \ | ||
GOARCH=amd64 | ||
|
||
WORKDIR /app | ||
|
||
COPY go.mod . | ||
COPY go.sum . | ||
|
||
RUN go mod download | ||
|
||
# Copy the code into the container | ||
COPY . . | ||
|
||
# Build the application | ||
RUN go build -o main . | ||
|
||
# Move to /dist directory as the place for resulting binary folder | ||
WORKDIR /dist | ||
|
||
# Copy binary from build to main folder | ||
RUN cp /build/main . | ||
RUN go build | ||
|
||
# Command to run when starting the container | ||
CMD ["/dist/main"] | ||
ENTRYPOINT ["/app/main"] |