Skip to content

Commit 2a82f0a

Browse files
authored
Merging PR from main- refactor: add dockerfile for windows build and make build-binaries #1720 (#1842)
# Description Merging PR from main- refactor: add dockerfile for windows build and make build-binaries #1720 We want to separate the windows build into 2 steps Build the binaries needed for the final image Build the final image including the binaries built in step 1 For step 1, add a build-binaries task to the Makefile that builds the binaries needed for the final image. For step 2, add a Dockerfile for the windows build that builds the final image including the binaries built in step 1 ## Related Issue Make window's build branch compatible with release pipeline Please refer to the [CONTRIBUTING.md](../CONTRIBUTING.md) file for more information on how to contribute to this project.
1 parent 885e2fd commit 2a82f0a

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,10 @@ all-gen: ## generate all code
339339
$(MAKE) proto-gen
340340
$(MAKE) go-gen
341341

342+
build-windows-binaries:
343+
GOOS=windows GOARCH=$(GOARCH) go build -v -o /go/bin/retina/captureworkload -ldflags "-X github.com/microsoft/retina/internal/buildinfo.Version=$(TAG) -X github.com/microsoft/retina/internal/buildinfo.ApplicationInsightsID=$(APP_INSIGHTS_ID)" captureworkload/main.go
344+
GOOS=windows GOARCH=$(GOARCH) go build -x -v -o /go/bin/retina/controller -ldflags "-X github.com/microsoft/retina/internal/buildinfo.Version=$(TAG) -X github.com/microsoft/retina/internal/buildinfo.ApplicationInsightsID=$(APP_INSIGHTS_ID)" controller/main.go
345+
342346
##@ Multiplatform
343347

344348
manifest-retina-image: ## create a multiplatform manifest for the retina image
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Only applicable for windows images
2+
ARG OS_VERSION=ltsc2022
3+
# pinned base images
4+
5+
# mcr.microsoft.com/windows/servercore:ltsc2019
6+
FROM mcr.microsoft.com/windows/servercore@sha256:6fdf140282a2f809dae9b13fe441635867f0a27c33a438771673b8da8f3348a4 AS ltsc2019
7+
8+
# mcr.microsoft.com/windows/servercore:ltsc2022
9+
FROM mcr.microsoft.com/windows/servercore@sha256:45952938708fbde6ec0b5b94de68bcdec3f8c838be018536b1e9e5bd95e6b943 AS ltsc2022
10+
11+
FROM ${OS_VERSION} AS agent-win
12+
ARG GOARCH=amd64 # default to amd64
13+
ARG GOOS=windows # default to windows
14+
ARG OS_VERSION=ltsc2022
15+
ARG REPO_PATH
16+
ARG BINARIES_PATH
17+
ENV GOARCH=${GOARCH}
18+
ENV GOOS=${GOOS}
19+
ENV OS_VERSION=${OS_VERSION}
20+
ENV BINARIES_PATH=${BINARIES_PATH}
21+
ENV REPO_PATH=${REPO_PATH}
22+
COPY ${REPO_PATH}/retina/windows/kubeconfigtemplate.yaml kubeconfigtemplate.yaml
23+
COPY ${REPO_PATH}/retina/windows/setkubeconfigpath.ps1 setkubeconfigpath.ps1
24+
COPY ${BINARIES_PATH}/captureworkload.exe captureworkload.exe
25+
COPY ${BINARIES_PATH}/controller.exe controller.exe
26+
ADD https://github.com/microsoft/etl2pcapng/releases/download/v1.10.0/etl2pcapng.exe /etl2pcapng.exe
27+
CMD ["controller.exe", "start", "--kubeconfig=.\\kubeconfig"]

0 commit comments

Comments
 (0)