Skip to content
This repository has been archived by the owner on Mar 5, 2024. It is now read-only.

switch to using go modules #315

Merged
merged 7 commits into from
Nov 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ pipeline:
test:
secrets: [ codecov_token ]
image: golang:1.12
environment:
GO111MODULE: "on"
commands:
- make test
- make coverage.txt
- ./ci/codecov.sh

benchmarks:
image: golang:1.12
environment:
GO111MODULE: "on"
commands:
- make bench

Expand Down
22 changes: 17 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
FROM golang:1.12-alpine3.10 as build
RUN apk add --no-cache make
WORKDIR /go/src/github.com/uswitch/kiam
ADD . .
FROM golang:1.12.5 as build
ENV GO111MODULE=on

WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download
Copy link
Contributor

@surajnarwade surajnarwade Nov 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

go build takes care of downloading the dependencies, we don't need go mod download

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was referring mostly to what kubebuilder does in caching docker layers: https://github.com/kubernetes-sigs/kubebuilder/blob/master/testdata/project-v2/Dockerfile#L8

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, TFS


COPY cmd/ cmd/
COPY pkg/ pkg/
COPY proto/ proto/
COPY Makefile Makefile

RUN make bin/kiam-linux-amd64

FROM alpine:3.8
RUN apk --no-cache add iptables
COPY --from=build /go/src/github.com/uswitch/kiam/bin/kiam-linux-amd64 /kiam
COPY --from=build /workspace/bin/kiam-linux-amd64 /kiam
CMD []
Loading