Skip to content

Commit

Permalink
Fix publish windows runtime (#7143)
Browse files Browse the repository at this point in the history
* support windows platform in builder

Signed-off-by: Brooks Newberry <[email protected]>

* update windows image pull filter

Signed-off-by: Brooks Newberry <[email protected]>

* publish manifest with buildx imagetools

Signed-off-by: Brooks Newberry <[email protected]>

---------

Signed-off-by: Brooks Newberry <[email protected]>
  • Loading branch information
brooksn authored Oct 28, 2024
1 parent c0e7e1e commit 857acbd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 17 deletions.
5 changes: 3 additions & 2 deletions Dockerfile.windows
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.20 AS build
FROM --platform=$BUILDPLATFORM alpine:3.20 AS build

RUN apk --no-cache add \
curl \
Expand Down Expand Up @@ -38,7 +38,7 @@ RUN curl -sL https://raw.githubusercontent.com/golangci/golangci-lint/master/ins
WORKDIR /source
# End Dapper stuff

FROM rancher/hardened-containerd:v1.7.22-k3s1-build20241010-amd64-windows AS containerd
FROM --platform=$BUILDPLATFORM rancher/hardened-containerd:v1.7.22-k3s1-build20241010-amd64-windows AS containerd
FROM build as windows-runtime-collect
ARG KUBERNETES_VERSION=dev

Expand Down Expand Up @@ -107,6 +107,7 @@ RUN mv CalicoWindows/confd confd/
FROM scratch AS windows-runtime
LABEL org.opencontainers.image.url="https://hub.docker.com/r/rancher/rke2-runtime"
LABEL org.opencontainers.image.source="https://github.com/rancher/rke2"
WORKDIR /bin/
COPY --from=containerd /usr/local/bin/*.exe /bin/
COPY --from=windows-runtime-collect ./rancher/* /bin/
COPY --from=windows-runtime-collect ./confd/ /bin/confd
Expand Down
8 changes: 4 additions & 4 deletions scripts/package-windows-images
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ source ./scripts/version.sh
mkdir -p dist/artifacts

# ltsc1809 / Server 2019 1809
crane pull --platform windows/amd64:10.0.17763.2114 \
crane pull --platform windows/amd64 \
${REGISTRY}/${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-windows-amd64 \
${REGISTRY}/${REPO}/mirrored-pause:${PAUSE_VERSION} \
${REGISTRY}/${REPO}/mirrored-pause:${PAUSE_VERSION}-amd64-windows-10.0.17763.2114 \
rke2-windows-1809-amd64-images.tar

# ltsc2022 / Server 2022 21H2
crane pull --platform windows/amd64:10.0.20348.169 \
crane pull --platform windows/amd64 \
${REGISTRY}/${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-windows-amd64 \
${REGISTRY}/${REPO}/mirrored-pause:${PAUSE_VERSION} \
${REGISTRY}/${REPO}/mirrored-pause:${PAUSE_VERSION}-amd64-windows-10.0.20348.169 \
rke2-windows-ltsc2022-amd64-images.tar

WINDOWS_TARFILES=(rke2-windows-1809-amd64-images.tar rke2-windows-ltsc2022-amd64-images.tar)
Expand Down
1 change: 1 addition & 0 deletions scripts/publish-image-runtime-windows
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ docker buildx build ${IID_FILE_FLAG} \
--tag ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-windows-amd64 \
--target windows-runtime \
--file Dockerfile.windows \
--platform windows/amd64 \
--push \
.
16 changes: 5 additions & 11 deletions scripts/publish-manifest-runtime
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,15 @@ cd $(dirname $0)/..
source ./scripts/version.sh
export DOCKER_CLI_EXPERIMENTAL=enabled

docker manifest create \
${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION} \
${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-linux-amd64 \
${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-linux-arm64 \
${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-windows-amd64

docker manifest annotate ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION} ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-linux-amd64 --os linux --arch amd64
docker manifest annotate ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION} ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-linux-arm64 --os linux --arch arm64
docker manifest annotate ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION} ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-windows-amd64 --os windows --arch amd64

set +x
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
set -x

docker manifest push ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}
docker buildx imagetools create \
--tag ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION} \
${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-linux-amd64 \
${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-linux-arm64 \
${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-windows-amd64

if [ -n "${IID_FILE}" ]; then
docker buildx imagetools inspect --format "{{json .Manifest}}" ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION} | jq -r '.digest' > ${IID_FILE}
Expand Down

0 comments on commit 857acbd

Please sign in to comment.