-
Notifications
You must be signed in to change notification settings - Fork 379
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Windows] Use hpc to build Agent images (#6325)
1. Use Windows hpc as the base image to store Antrea binary and OVS files 2. Use docker buildx to build Windows image on Linux base environment 3. Modify OVS init container to install redist files 4. Place openssl dll files into OVS binary directory instead of Windows system path 5. Remove original windows-base image, and download CNI file in agent image Using the hpc base image and buildx on a fresh env, the time to build Windows related images and push to remote registry is greatly reduced. Signed-off-by: Wenying Dong <[email protected]>
- Loading branch information
Showing
18 changed files
with
293 additions
and
320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,45 +12,40 @@ | |
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
ARG WIN_BUILD_TAG | ||
ARG NANOSERVER_VERSION | ||
ARG WIN_BUILD_OVS_TAG | ||
ARG GO_VERSION | ||
ARG OVS_VERSION | ||
|
||
FROM antrea/base-windows:${WIN_BUILD_TAG} as antrea-build-windows | ||
FROM --platform=linux/amd64 golang:${GO_VERSION} as antrea-build-windows | ||
ARG CNI_BINARIES_VERSION | ||
ENV CNI_PLUGINS="./host-local.exe" | ||
|
||
WORKDIR /antrea | ||
|
||
COPY go.mod /antrea/go.mod | ||
ADD https://github.com/containernetworking/plugins/releases/download/${CNI_BINARIES_VERSION}/cni-plugins-windows-amd64-${CNI_BINARIES_VERSION}.tgz cni-plugins-windows-amd64.tgz | ||
RUN mkdir -p /go/k/antrea/cni && \ | ||
tar -xzf cni-plugins-windows-amd64.tgz -C /go/k/antrea/cni ${CNI_PLUGINS} && \ | ||
rm cni-plugins-windows-amd64.tgz | ||
|
||
RUN go mod download | ||
RUN --mount=type=cache,target=/go/pkg/mod/ \ | ||
--mount=type=bind,source=go.sum,target=go.sum \ | ||
--mount=type=bind,source=go.mod,target=go.mod \ | ||
go mod download | ||
|
||
COPY . /antrea | ||
|
||
RUN sh -c 'make windows-bin' | ||
RUN --mount=type=cache,target=/go/pkg/mod/ \ | ||
--mount=type=cache,target=/root/.cache/go-build/ \ | ||
make windows-bin | ||
|
||
FROM antrea/windows-ovs:${WIN_BUILD_OVS_TAG} as windows-ovs | ||
RUN mkdir -p /go/k/antrea/bin && \ | ||
cp /antrea/bin/antrea-agent.exe /go/k/antrea/bin/ && \ | ||
cp /antrea/bin/antctl.exe /go/k/antrea/bin/ && \ | ||
cp /antrea/bin/antrea-cni.exe /go/k/antrea/cni/antrea.exe | ||
|
||
FROM mcr.microsoft.com/powershell:lts-nanoserver-${NANOSERVER_VERSION} | ||
SHELL ["pwsh", "-NoLogo", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] | ||
FROM antrea/windows-ovs:${OVS_VERSION} as antrea-ovs | ||
|
||
LABEL maintainer="Antrea <[email protected]>" | ||
LABEL description="A Docker image to deploy the Antrea CNI." | ||
FROM mcr.microsoft.com/oss/kubernetes/windows-host-process-containers-base-image:v1.0.0 | ||
COPY --from=antrea-build-windows /go/k /k | ||
COPY --from=antrea-ovs /openvswitch /openvswitch | ||
|
||
USER ContainerAdministrator | ||
|
||
RUN mkdir -Force C:\k\antrea\bin | ||
COPY --from=antrea-build-windows /opt/cni/bin /k/antrea/cni | ||
COPY --from=antrea-build-windows /antrea/build/images/scripts/Install-WindowsCNI.ps1 /k/antrea/ | ||
COPY --from=antrea-build-windows /antrea/bin/antrea-agent.exe /k/antrea/bin/ | ||
COPY --from=antrea-build-windows /antrea/bin/antctl.exe /k/antrea/bin/antctl.exe | ||
COPY --from=antrea-build-windows /antrea/bin/antrea-cni.exe /k/antrea/cni/antrea.exe | ||
|
||
RUN mkdir C:\k\antrea\utils | ||
COPY --from=antrea-build-windows /wins/wins.exe /k/antrea/utils/wins.exe | ||
|
||
COPY --from=windows-ovs /Windows/System32/vcruntime140.dll /Windows/System32/ | ||
COPY --from=windows-ovs /Windows/System32/libeay32.dll /Windows/System32/ | ||
COPY --from=windows-ovs /Windows/System32/ssleay32.dll /Windows/System32/ | ||
|
||
RUN mkdir C:\openvswitch | ||
COPY --from=windows-ovs /openvswitch /openvswitch/ | ||
ENV PATH="C:\Windows\system32;C:\Windows;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\wbem;" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.