Skip to content
This repository has been archived by the owner on Sep 19, 2022. It is now read-only.

Commit

Permalink
+ add ckube plugin build in Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
kebe7jun committed Apr 24, 2022
1 parent a9dbd4f commit 53266f2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.17
- name: golangci-lint
if: github.event_name == 'pull_request'
uses: golangci/golangci-lint-action@v2
Expand Down
9 changes: 7 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,25 @@ FROM golang:1.17-stretch as build

WORKDIR /app

RUN wget https://storage.googleapis.com/kubernetes-release/release/v1.23.3/bin/linux/$(uname -m | sed -E 's/x86_64/amd64/g' | sed -E 's/aarch64/arm64/g')/kubectl -O /usr/bin/kubectl && \
chmod +x /usr/bin/kubectl

ADD go.mod .
ADD go.sum .

RUN go mod download

ADD . .

RUN go build -ldflags "-s -w" -o ./dist/cacheproxy cmd/cacheproxy/main.go

RUN go build -ldflags "-s -w" -o ./dist/cacheproxy ./cmd/cacheproxy/main.go && \
go build -ldflags "-s -w" -o ./dist/kubectl-ckube ./cmd/ckube-plugin/main.go

FROM ubuntu:20.04

WORKDIR /app

COPY --from=build /usr/bin/kubectl /usr/local/bin/
COPY --from=build /app/dist/kubectl-ckube /usr/local/bin/
COPY --from=build /app/dist/cacheproxy dist/cacheproxy

CMD ["/app/dist/cacheproxy"]

0 comments on commit 53266f2

Please sign in to comment.