forked from Azure/azure-container-networking
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add windows build pool and NPM windows dockerfile (Azure#1073)
* build pool windows
- Loading branch information
Showing
8 changed files
with
118 additions
and
19 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 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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
stages: | ||
- stage: build_windows_images | ||
displayName: Build Windows Images | ||
dependsOn: | ||
- "setup" | ||
jobs: | ||
- job: NPM | ||
displayName: Build NPM | ||
variables: | ||
tag: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.Tag'] ] | ||
pool: | ||
name: "$(BUILD_POOL_NAME_DEFAULT_WINDOWS)" | ||
steps: | ||
- powershell: | | ||
powershell.exe -command "& { . .\windows.ps1; azure-npm-image $(tag)-windows-amd64 }" | ||
name: "build_npm" | ||
displayName: "Build" | ||
- task: Docker@2 | ||
displayName: Docker Login | ||
inputs: | ||
containerRegistry: $(ACR_SERVICE_CONNECTION) | ||
command: 'login' | ||
addPipelineData: false | ||
|
||
- powershell: | | ||
docker tag acnpublic.azurecr.io/azure-npm:$(tag)-windows-amd64 acnpublic.azurecr.io/azure-npm:$(tag)-windows-amd64-test | ||
docker push acnpublic.azurecr.io/azure-npm:$(tag)-windows-amd64-test | ||
name: "push_npm" | ||
displayName: "Push" | ||
- powershell: | | ||
mkdir .\output\images\windows\ | ||
docker save acnpublic.azurecr.io/azure-npm:$(tag)-windows-amd64-test -o .\output\images\windows\azure-npm-$(tag)-windows-amd64.tar | ||
name: "save_npm" | ||
displayName: "Save" | ||
- task: Docker@2 | ||
displayName: Docker Logout | ||
inputs: | ||
containerRegistry: $(ACR_SERVICE_CONNECTION) | ||
command: 'logout' | ||
addPipelineData: false | ||
|
||
- task: CopyFiles@2 | ||
inputs: | ||
sourceFolder: "output" | ||
targetFolder: $(Build.ArtifactStagingDirectory) | ||
condition: succeeded() | ||
|
||
- task: PublishBuildArtifacts@1 | ||
inputs: | ||
artifactName: "output" | ||
pathtoPublish: "$(Build.ArtifactStagingDirectory)" | ||
condition: succeeded() |
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 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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM golang:windowsservercore-ltsc2022 AS builder | ||
# Build args | ||
ARG VERSION | ||
ARG NPM_AI_PATH | ||
ARG NPM_AI_ID | ||
|
||
WORKDIR /usr/src/npm | ||
RUN mkdir /usr/bin/ | ||
# Copy the source | ||
COPY . . | ||
|
||
RUN $Env:CGO_ENABLED=0; go build -v -o /usr/bin/npm.exe -ldflags """-X main.version=${env:VERSION} -X ${env:NPM_AI_PATH}=${env:NPM_AI_ID}""" -gcflags="-dwarflocationlists=true" ./npm/cmd/ | ||
|
||
# Copy into final image | ||
FROM mcr.microsoft.com/windows/nanoserver:ltsc2022 | ||
COPY --from=builder /Windows/System32/netapi32.dll /Windows/System32/netapi32.dll | ||
COPY --from=builder /usr/bin/npm.exe \ | ||
/usr/bin/npm.exe | ||
|
||
ENTRYPOINT ["/usr/bin/npm.exe", "start"] |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
function azure-npm-image { | ||
$env:ACN_PACKAGE_PATH = "github.com/Azure/azure-container-networking" | ||
$env:NPM_AI_ID = "014c22bd-4107-459e-8475-67909e96edcb" | ||
$env:NPM_AI_PATH="$env:ACN_PACKAGE_PATH/npm.aiMetadata" | ||
|
||
if ($null -eq $env:VERSION) { $env:VERSION = $args[0] } | ||
docker build ` | ||
-f npm/Dockerfile.windows ` | ||
-t acnpublic.azurecr.io/azure-npm:$env:VERSION ` | ||
--build-arg VERSION=$env:VERSION ` | ||
--build-arg NPM_AI_PATH=$env:NPM_AI_PATH ` | ||
--build-arg NPM_AI_ID=$env:NPM_AI_ID ` | ||
. | ||
} |