Skip to content

Commit

Permalink
Allow CSI proxy build arg to pass to docker build process
Browse files Browse the repository at this point in the history
  • Loading branch information
laozc committed May 9, 2024
1 parent 3ad1e4a commit 8cb5dc7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
7 changes: 4 additions & 3 deletions hostprocess/csi-proxy/Dockerfile.windows
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
ARG REGISTRY=mcr.microsoft.com/oss/kubernetes
ARG WINDOWS_BASE_IMAGE=windows-host-process-containers-base-image
ARG WINDOWS_VERSION=v1.0.0
ARG WINDOWS_BASE_IMAGE_VERSION=v1.0.0
ARG BUILDER_BASE_IMAGE=golang

FROM --platform=linux/amd64 golang:1.20 as builder
FROM --platform=linux/amd64 ${BUILDER_BASE_IMAGE}:1.20 as builder
ARG CSI_PROXY_VERSION=v1.1.3
RUN git clone https://github.com/kubernetes-csi/csi-proxy.git /go/csi-proxy &&\
cd /go/csi-proxy &&\
git checkout tags/${CSI_PROXY_VERSION} &&\
make build

FROM ${REGISTRY}/${WINDOWS_BASE_IMAGE}:${WINDOWS_VERSION}
FROM ${REGISTRY}/${WINDOWS_BASE_IMAGE}:${WINDOWS_BASE_IMAGE_VERSION}
COPY --from=builder /go/csi-proxy/bin/csi-proxy.exe /csi-proxy.exe
ENV PATH="C:\Windows\system32;C:\Windows;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\wbem;"
ENTRYPOINT ["csi-proxy.exe", "-v", "4"]
17 changes: 13 additions & 4 deletions hostprocess/csi-proxy/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,22 @@ if [[ "$push" == "1" ]]; then
output="type=registry"
fi

repository=${repository:-"ghcr.io/kubernetes-sigs/sig-windows"}
CSI_PROXY_VERSION=${CSI_PROXY_VERSION:-"v1.1.3"}
REPOSITORY=${REPOSITORY:-"ghcr.io/kubernetes-sigs/sig-windows"}
WINDOWS_BASE_IMAGE_REGISTRY=${WINDOWS_BASE_IMAGE_REGISTRY:-"mcr.microsoft.com/oss/kubernetes"}
WINDOWS_BASE_IMAGE=${WINDOWS_BASE_IMAGE:-"windows-host-process-containers-base-image"}
WINDOWS_BASE_IMAGE_VERSION=${WINDOWS_BASE_IMAGE_VERSION:-"v1.0.0"}
BUILDER_BASE_IMAGE=${BUILDER_BASE_IMAGE:-"golang"}

set -x

docker buildx create --name img-builder --use --platform windows/amd64
trap 'docker buildx rm img-builder' EXIT


docker buildx build --platform windows/amd64 --output=$output -f Dockerfile.windows -t ${repository}/csi-proxy:${version} .

docker buildx build --platform windows/amd64 --output=$output -f Dockerfile.windows \
--build-arg REGISTRY=${WINDOWS_BASE_IMAGE_REGISTRY} \
--build-arg WINDOWS_BASE_IMAGE=${WINDOWS_BASE_IMAGE} \
--build-arg WINDOWS_BASE_IMAGE_VERSION=${WINDOWS_BASE_IMAGE_VERSION} \
--build-arg BUILDER_BASE_IMAGE=${BUILDER_BASE_IMAGE} \
--build-arg CSI_PROXY_VERSION=${CSI_PROXY_VERSION} \
-t ${REPOSITORY}/csi-proxy:${version} .
2 changes: 1 addition & 1 deletion hostprocess/csi-proxy/csi-proxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ spec:
hostNetwork: true
containers:
- name: csi-proxy
image: ghcr.io/kubernetes-sigs/sig-windows/csi-proxy:v1.1.2
image: ghcr.io/kubernetes-sigs/sig-windows/csi-proxy:v1.1.3

0 comments on commit 8cb5dc7

Please sign in to comment.