Skip to content

Commit e21602c

Browse files
committed
Use vendored modules in image build
Use vendor folder instead of running go mod download during the build. Update .dockerignore Signed-off-by: Han Verstraete (OpenFaaS Ltd) <[email protected]>
1 parent 8906805 commit e21602c

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

.dockerignore

+16-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,16 @@
1-
./inlets-operator
1+
./inlets-operator
2+
.tools
3+
chart
4+
hack
5+
docs
6+
contrib
7+
LICENSE
8+
Makefile
9+
*.md
10+
11+
.git
12+
.dockerignore
13+
Dockerfile
14+
.github
15+
.gitignore
16+
.DEREK.yml

Dockerfile

+3-15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
FROM --platform=${BUILDPLATFORM:-linux/amd64} ghcr.io/openfaas/license-check:0.4.1 as license-check
2-
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.23 as builder
1+
FROM --platform=${BUILDPLATFORM:-linux/amd64} ghcr.io/openfaas/license-check:0.4.1 AS license-check
2+
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.23 AS builder
33

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

20-
# Cache the download before continuing
21-
COPY go.mod go.mod
22-
COPY go.sum go.sum
23-
RUN go mod download
24-
25-
COPY pkg pkg
26-
COPY main.go main.go
27-
COPY image_test.go image_test.go
28-
COPY controller.go controller.go
29-
COPY validate.go validate.go
30-
COPY validate_test.go validate_test.go
31-
COPY config.go config.go
32-
COPY config_test.go config_test.go
20+
COPY . .
3321

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

0 commit comments

Comments
 (0)