Skip to content

Commit

Permalink
Use vendored modules in image build
Browse files Browse the repository at this point in the history
Use vendor folder instead of running go mod download during the build.
Update .dockerignore

Signed-off-by: Han Verstraete (OpenFaaS Ltd) <[email protected]>
  • Loading branch information
welteki committed Jan 16, 2025
1 parent 8906805 commit e21602c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
17 changes: 16 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
./inlets-operator
./inlets-operator
.tools
chart
hack
docs
contrib
LICENSE
Makefile
*.md

.git
.dockerignore
Dockerfile
.github
.gitignore
.DEREK.yml
18 changes: 3 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM --platform=${BUILDPLATFORM:-linux/amd64} ghcr.io/openfaas/license-check:0.4.1 as license-check
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.23 as builder
FROM --platform=${BUILDPLATFORM:-linux/amd64} ghcr.io/openfaas/license-check:0.4.1 AS license-check
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.23 AS builder

ARG TARGETPLATFORM
ARG BUILDPLATFORM
Expand All @@ -17,19 +17,7 @@ COPY --from=license-check /license-check /usr/bin/
RUN mkdir -p /go/src/github.com/inlets/inlets-operator
WORKDIR /go/src/github.com/inlets/inlets-operator

# Cache the download before continuing
COPY go.mod go.mod
COPY go.sum go.sum
RUN go mod download

COPY pkg pkg
COPY main.go main.go
COPY image_test.go image_test.go
COPY controller.go controller.go
COPY validate.go validate.go
COPY validate_test.go validate_test.go
COPY config.go config.go
COPY config_test.go config_test.go
COPY . .

RUN gofmt -l -d $(find . -type f -name '*.go' -not -path "./vendor/*")

Expand Down

0 comments on commit e21602c

Please sign in to comment.