-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 changed file
with
6 additions
and
21 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,24 +1,9 @@ | ||
FROM golang:alpine | ||
|
||
# Set necessary environmet variables needed for our image | ||
ENV GO111MODULE=on \ | ||
CGO_ENABLED=0 \ | ||
GOOS=linux \ | ||
GOARCH=amd64 | ||
|
||
# Create app directory | ||
FROM golang:alpine AS builder | ||
WORKDIR /app | ||
|
||
# Copy all other source code to work directory | ||
COPY . . | ||
RUN CGO_ENABLED=0 go build -o binary main.go | ||
|
||
# Expose port | ||
EXPOSE 3000 | ||
|
||
# Download all the dependencies that are required | ||
RUN go mod tidy | ||
|
||
# Build the application | ||
RUN go build -o binary main.go | ||
|
||
ENTRYPOINT ["/app/binary"] | ||
FROM alpine:3 | ||
RUN apk update && apk add --no-cache ca-certificates tzdata && update-ca-certificates | ||
COPY --from=builder /app/binary . | ||
ENTRYPOINT ["./binary"] |