Skip to content

Commit

Permalink
use multi-stage build image
Browse files Browse the repository at this point in the history
  • Loading branch information
joostvdg committed May 13, 2020
1 parent 11232da commit cf9a2a4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: get dependency
run: go get -t -v ./...
- name: build
run: make linux
# Setup gcloud CLI
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with:
Expand Down
15 changes: 12 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
FROM scratch
FROM golang:1.14 as builder
WORKDIR /go/src/cmg
COPY go.* ./
RUN go mod download
COPY . ./
RUN CGO_ENABLED=0 GOOS=linux go build -v -o cmg

FROM alpine:3
RUN apk --no-cache add ca-certificates
EXPOSE 8080
ENTRYPOINT ["/cmg"]
ENV PORT=8080
ENTRYPOINT ["/usr/bin/cmg"]
CMD ["serve"]
COPY ./bin/ /usr/bin
COPY --from=builder /go/src/cmg/cmg /usr/bin/cmg

0 comments on commit cf9a2a4

Please sign in to comment.