Skip to content

Commit

Permalink
CNF-13590: Use the vendor directory when building images (#128)
Browse files Browse the repository at this point in the history
Description:
- remove the vendor directory from .gitignore and .containerignore
  so that it gets copied into the image with the rest of the
  content
- add -mod=vendor to go build commands
  • Loading branch information
irinamihai authored Jul 26, 2024
1 parent f48efaf commit 76fce1e
Show file tree
Hide file tree
Showing 3,946 changed files with 1,443,684 additions and 12 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 1 addition & 0 deletions .containerignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
!/cmd
!/api
!/bundle
!/vendor
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
*.log
/__debug*
/oran-o2ims
/vendor
/bin/*
5 changes: 0 additions & 5 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ COPY \
--chown=builder:builder \
. .

# Download the Go dependencies. We do this in a separate step so that hopefully that large set of
# dependencies will be in a cached layer, and we will not need to download them for every build.
RUN \
go mod download

# Build the binary:
RUN \
make binary
Expand Down
6 changes: 1 addition & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod 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 the go source
COPY . .

Expand All @@ -19,7 +15,7 @@ COPY . .
# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO
# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore,
# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -mod=vendor -a

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ catalog-push: ## Push a catalog image.
##@ Binary
.PHONY: binary
binary:
go build
go build -mod=vendor

.PHONY: image
image:
Expand Down
30 changes: 30 additions & 0 deletions vendor/github.com/PaesslerAG/gval/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions vendor/github.com/PaesslerAG/gval/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions vendor/github.com/PaesslerAG/gval/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

156 changes: 156 additions & 0 deletions vendor/github.com/PaesslerAG/gval/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 76fce1e

Please sign in to comment.