Skip to content

Commit

Permalink
Change build commands to use vendoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
jkh52 committed Jan 24, 2024
1 parent 3ee0347 commit 1771674
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 29 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,16 @@ bin:
build: bin/proxy-agent bin/proxy-server bin/proxy-test-client bin/http-test-server

bin/proxy-agent: bin $(SOURCE)
GO111MODULE=on go build -o bin/proxy-agent cmd/agent/main.go
GO111MODULE=on go build -mod=vendor -o bin/proxy-agent cmd/agent/main.go

bin/proxy-test-client: bin $(SOURCE)
GO111MODULE=on go build -o bin/proxy-test-client cmd/test-client/main.go
GO111MODULE=on go build -mod=vendor -o bin/proxy-test-client cmd/test-client/main.go

bin/http-test-server: bin $(SOURCE)
GO111MODULE=on go build -o bin/http-test-server cmd/test-server/main.go
GO111MODULE=on go build -mod=vendor -o bin/http-test-server cmd/test-server/main.go

bin/proxy-server: bin $(SOURCE)
GO111MODULE=on go build -o bin/proxy-server cmd/server/main.go
GO111MODULE=on go build -mod=vendor -o bin/proxy-server cmd/server/main.go

## --------------------------------------
## Linting
Expand Down
11 changes: 5 additions & 6 deletions artifacts/images/agent-build.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,21 @@ WORKDIR /go/src/sigs.k8s.io/apiserver-network-proxy
COPY go.mod go.mod
COPY go.sum go.sum

# This is required before go mod download because we have a
# replace directive for konnectivity-client in go.mod
# The download will fail without the directory present
# We have a replace directive for konnectivity-client in go.mod
COPY konnectivity-client/ konnectivity-client/

# Cache dependencies
RUN go mod download
# Copy vendored modules
COPY vendor/ vendor/

# Copy the sources
COPY pkg/ pkg/
COPY cmd/ cmd/
COPY proto/ proto/


# Build
ARG ARCH
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -v -a -ldflags '-extldflags "-static"' -o proxy-agent sigs.k8s.io/apiserver-network-proxy/cmd/agent
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -mod=vendor -v -a -ldflags '-extldflags "-static"' -o proxy-agent sigs.k8s.io/apiserver-network-proxy/cmd/agent

# Copy the loader into a thin image
FROM gcr.io/distroless/static-debian11
Expand Down
10 changes: 4 additions & 6 deletions artifacts/images/server-build.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ WORKDIR /go/src/sigs.k8s.io/apiserver-network-proxy
COPY go.mod go.mod
COPY go.sum go.sum

# This is required before go mod download because we have a
# replace directive for konnectivity-client in go.mod
# The download will fail without the directory present
# We have a replace directive for konnectivity-client in go.mod
COPY konnectivity-client/ konnectivity-client/

# Cache dependencies
RUN go mod download
# Copy vendored modules
COPY vendor/ vendor/

# Copy the sources
COPY pkg/ pkg/
Expand All @@ -23,7 +21,7 @@ COPY proto/ proto/

# Build
ARG ARCH
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -v -a -ldflags '-extldflags "-static"' -o proxy-server sigs.k8s.io/apiserver-network-proxy/cmd/server
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -mod=vendor -v -a -ldflags '-extldflags "-static"' -o proxy-server sigs.k8s.io/apiserver-network-proxy/cmd/server

# Copy the loader into a thin image
FROM gcr.io/distroless/static-debian11
Expand Down
10 changes: 4 additions & 6 deletions artifacts/images/test-client-build.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ WORKDIR /go/src/sigs.k8s.io/apiserver-network-proxy
COPY go.mod go.mod
COPY go.sum go.sum

# This is required before go mod download because we have a
# replace directive for konnectivity-client in go.mod
# The download will fail without the directory present
# We have a replace directive for konnectivity-client in go.mod
COPY konnectivity-client/ konnectivity-client/

# Cache dependencies
RUN go mod download
# Copy vendored modules
COPY vendor/ vendor/

# Copy the sources
COPY pkg/ pkg/
Expand All @@ -23,7 +21,7 @@ COPY proto/ proto/

# Build
ARG ARCH
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -v -a -ldflags '-extldflags "-static"' -o proxy-test-client sigs.k8s.io/apiserver-network-proxy/cmd/test-client
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -mod=vendor -v -a -ldflags '-extldflags "-static"' -o proxy-test-client sigs.k8s.io/apiserver-network-proxy/cmd/test-client

# Copy the loader into a thin image
FROM gcr.io/distroless/static-debian11
Expand Down
11 changes: 4 additions & 7 deletions artifacts/images/test-server-build.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,19 @@ WORKDIR /go/src/sigs.k8s.io/apiserver-network-proxy
COPY go.mod go.mod
COPY go.sum go.sum


# This is required before go mod download because we have a
# replace directive for konnectivity-client in go.mod
# The download will fail without the directory present
# We have a replace directive for konnectivity-client in go.mod
COPY konnectivity-client/ konnectivity-client/

# Cache dependencies
RUN go mod download
# Copy vendored modules
COPY vendor/ vendor/

# Copy the sources
COPY pkg/ pkg/
COPY cmd/ cmd/

# Build
ARG ARCH
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -v -a -ldflags '-extldflags "-static"' -o http-test-server sigs.k8s.io/apiserver-network-proxy/cmd/test-server
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -mod=vendor -v -a -ldflags '-extldflags "-static"' -o http-test-server sigs.k8s.io/apiserver-network-proxy/cmd/test-server

# Copy the loader into a thin image
FROM gcr.io/distroless/static-debian11
Expand Down

0 comments on commit 1771674

Please sign in to comment.