Skip to content

Commit

Permalink
Revert "Copy netapi32.dll from servercore image in nano-based Windo…
Browse files Browse the repository at this point in the history
…ws image (#9006)" (#9051)

This reverts commit 89b2770.
  • Loading branch information
clamoriniere authored Sep 2, 2021
1 parent 5391973 commit 960225e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
8 changes: 4 additions & 4 deletions .gitlab/image_build/docker_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
needs: ["windows_msi_and_bosh_zip_x64-a7", "build_windows_container_entrypoint"]
variables:
AGENT_ZIP: "datadog-agent-7*-x86_64.zip"
BUILD_ARG: "--build-arg BASE_IMAGE=mcr.microsoft.com/powershell:nanoserver-${VARIANT} --build-arg NETAPI32_IMAGE=mcr.microsoft.com/powershell:windowsservercore-${VARIANT} --build-arg WITH_JMX=${WITH_JMX} --build-arg VARIANT=${VARIANT}"
BUILD_ARG: "--build-arg BASE_IMAGE=mcr.microsoft.com/powershell:nanoserver-${VARIANT} --build-arg WITH_JMX=${WITH_JMX} --build-arg VARIANT=${VARIANT}"
TARGET_TAG: "${IMAGE}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}${TAG_SUFFIX}-win${VARIANT}-amd64"

.docker_build_agent6_windows_common:
Expand All @@ -77,21 +77,21 @@
needs: ["windows_msi_x64-a6", "build_windows_container_entrypoint"]
variables:
AGENT_ZIP: "datadog-agent-6*-x86_64.zip"
BUILD_ARG: "--build-arg BASE_IMAGE=mcr.microsoft.com/powershell:nanoserver-${VARIANT} --build-arg NETAPI32_IMAGE=mcr.microsoft.com/powershell:windowsservercore-${VARIANT} --build-arg WITH_JMX=${WITH_JMX} --build-arg VARIANT=${VARIANT}"
BUILD_ARG: "--build-arg BASE_IMAGE=mcr.microsoft.com/powershell:nanoserver-${VARIANT} --build-arg WITH_JMX=${WITH_JMX} --build-arg VARIANT=${VARIANT}"
TARGET_TAG: "${IMAGE}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}${TAG_SUFFIX}-win${VARIANT}-amd64"

.docker_build_agent6_windows_servercore_common:
extends:
- .docker_build_agent6_windows_common
variables:
BUILD_ARG: "--build-arg BASE_IMAGE=mcr.microsoft.com/powershell:windowsservercore-${VARIANT} --build-arg NETAPI32_IMAGE=mcr.microsoft.com/powershell:windowsservercore-${VARIANT} --build-arg WITH_JMX=${WITH_JMX} --build-arg VARIANT=${VARIANT}"
BUILD_ARG: "--build-arg BASE_IMAGE=mcr.microsoft.com/powershell:windowsservercore-${VARIANT} --build-arg WITH_JMX=${WITH_JMX} --build-arg VARIANT=${VARIANT}"
TARGET_TAG: "${IMAGE}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}${TAG_SUFFIX}-win${VARIANT}-servercore-amd64"

.docker_build_agent7_windows_servercore_common:
extends:
- .docker_build_agent7_windows_common
variables:
BUILD_ARG: "--build-arg BASE_IMAGE=mcr.microsoft.com/powershell:windowsservercore-${VARIANT} --build-arg NETAPI32_IMAGE=mcr.microsoft.com/powershell:windowsservercore-${VARIANT} --build-arg WITH_JMX=${WITH_JMX} --build-arg VARIANT=${VARIANT}"
BUILD_ARG: "--build-arg BASE_IMAGE=mcr.microsoft.com/powershell:windowsservercore-${VARIANT} --build-arg WITH_JMX=${WITH_JMX} --build-arg VARIANT=${VARIANT}"
TARGET_TAG: "${IMAGE}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}${TAG_SUFFIX}-win${VARIANT}-servercore-amd64"

include:
Expand Down
14 changes: 1 addition & 13 deletions Dockerfiles/agent/windows/amd64/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
ARG BASE_IMAGE=mcr.microsoft.com/powershell:lts-windowsservercore-1809
ARG NETAPI32_IMAGE=mcr.microsoft.com/powershell:lts-windowsservercore-1809

FROM ${NETAPI32_IMAGE} AS netapi32

FROM ${BASE_IMAGE} AS final
# This "copy netapi32.dll" hack can be reverted once https://github.com/microsoft/Windows-Containers/issues/72 is fixed.
COPY --from=netapi32 /Windows/System32/netapi32.dll /netapi32.dll
FROM ${BASE_IMAGE}

ARG WITH_JMX="false"
ARG VARIANT="unknown"
Expand All @@ -16,12 +10,6 @@ USER ContainerAdministrator

SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop';"]

RUN if (-not (Test-Path /Windows/System32/netapi32.dll)) { \
Move-Item /netapi32.dll -Destination /Windows/System32/netapi32.dll \
} else { \
Remove-Item /netapi32.dll \
}

COPY datadog-agent-latest.amd64.zip install.ps1 ./
RUN . ./install.ps1

Expand Down

0 comments on commit 960225e

Please sign in to comment.