diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9bf3136d1..c1df3ffef 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,6 +31,31 @@ jobs: with: go-version-file: 'go.mod' + # https://github.com/pl4nty/Windows-Containers/blob/Main/helpful_tools/Install-BuildKit-GitHubActions/workflow.yaml + - name: Setup containerd + run: | + $version = "1.7.17" + curl.exe -L https://github.com/containerd/containerd/releases/download/v$version/containerd-$version-windows-amd64.tar.gz -o containerd.tar.gz + tar.exe xvf containerd.tar.gz + .\bin\containerd.exe --register-service + Start-Service containerd + - name: Setup BuildKit + run: | + $version = "v0.13.2" + curl.exe -L https://github.com/moby/buildkit/releases/download/$version/buildkit-$version.windows-amd64.tar.gz -o buildkit.tar.gz + tar.exe xvf buildkit.tar.gz + + .\bin\buildkitd.exe --register-service + Start-Service buildkitd + - name: Setup Docker Buildx + run: | + $version = "v0.14.1" + curl.exe -L https://github.com/docker/buildx/releases/download/$version/buildx-$version.windows-amd64.exe -o $env:ProgramData\Docker\cli-plugins\docker-buildx.exe + - uses: docker/setup-buildx-action@v3 + with: + driver: remote + endpoint: npipe:////./pipe/buildkitd + - name: Install WiX run: dotnet tool install --global wix diff --git a/Makefile b/Makefile index dd1fa1d5e..422f4d9f1 100644 --- a/Makefile +++ b/Makefile @@ -58,10 +58,13 @@ package: crossbuild build-image: crossbuild $(DOCKER) build --build-arg=BASE=$(BASE_IMAGE):$(OS) -f Dockerfile -t local/$(DOCKER_IMAGE_NAME):$(VERSION)-$(OS) . +build-hostprocess: + $(DOCKER) buildx build --load --build-arg=BASE=mcr.microsoft.com/oss/kubernetes/windows-host-process-containers-base-image:v1.0.0 -f Dockerfile -t local/$(DOCKER_IMAGE_NAME):$(VERSION)-hostprocess . + sub-build-%: $(MAKE) OS=$* build-image -build-all: $(addprefix sub-build-,$(ALL_OS)) +build-all: $(addprefix sub-build-,$(ALL_OS)) build-hostprocess push: set -x; \ @@ -76,9 +79,16 @@ push: $(DOCKER) manifest push --purge $${docker_repo}/$(DOCKER_IMAGE_NAME):$(VERSION); \ done +push-hostprocess: + set -x; \ + for docker_repo in ${DOCKER_REPO}; do \ + $(DOCKER) tag local/$(DOCKER_IMAGE_NAME):$(VERSION)-hostprocess $${docker_repo}/$(DOCKER_IMAGE_NAME):$(VERSION)-hostprocess \ + $(DOCKER) push $${docker_repo}/$(DOCKER_IMAGE_NAME):$(VERSION)-hostprocess; + done + .PHONY: push-all push-all: build-all - $(MAKE) DOCKER_REPO="$(ALL_DOCKER_REPOS)" push + $(MAKE) DOCKER_REPO="$(ALL_DOCKER_REPOS)" push push-hostprocess # Mandatory target for container description sync action .PHONY: docker-repo-name diff --git a/README.md b/README.md index 4e547bb65..2142302e5 100644 --- a/README.md +++ b/README.md @@ -154,10 +154,16 @@ msiexec /i ENABLED_COLLECTORS=os,service --% EXTRA_FLAGS="--c The windows_exporter can be run as a Docker container. The Docker image is available on -* [Docker Hub](https://hub.docker.com/r/prometheuscommunity/windows-exporter): `ghcr.io/prometheus-community/windows-exporter` -* [GitHub Container Registry](https://github.com/prometheus-community/windows_exporter/pkgs/container/windows-exporter): `docker.io/prometheuscommunity/windows-exporter` +* [Docker Hub](https://hub.docker.com/r/prometheuscommunity/windows-exporter): `docker.io/prometheuscommunity/windows-exporter` +* [GitHub Container Registry](https://github.com/prometheus-community/windows_exporter/pkgs/container/windows-exporter): `ghcr.io/prometheus-community/windows-exporter` +### Tags + +The Docker image is tagged with the version of the exporter. The `latest` tag is also available and points to the latest release. + +Additionally, a flavor `hostprocess` with `-hostprocess` as suffix is based on the https://github.com/microsoft/windows-host-process-containers-base-image +which is designed to run as a Windows host process container. The size of that images is smaller than the default one. ## Kubernetes Implementation