Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing build arg when building csi-proxy Host Process Container #365

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading