Skip to content

Commit

Permalink
add windows support
Browse files Browse the repository at this point in the history
Signed-off-by: Maksim Paskal <[email protected]>
  • Loading branch information
maksim-paskal committed Jan 29, 2024
1 parent a270d83 commit cc07e22
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 6 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
81 changes: 81 additions & 0 deletions .github/workflows/test-multios.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
on: pull_request

env:
IMAGE: paskalmaksim/aks-node-termination-handler:test-${{ github.run_id }}
#${{github.ref_name}}

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
- run: go run github.com/goreleaser/goreleaser@latest build --clean --skip=validate --snapshot
- run: cp Dockerfile ./dist/aks-node-termination-handler_linux_amd64_v1/Dockerfile
- run: cp Dockerfile ./dist/aks-node-termination-handler_linux_arm64/Dockerfile
- run: cp Dockerfile.windows ./dist/aks-node-termination-handler_windows_amd64_v1/Dockerfile
- run: tar -cvf release.tar ./dist
- uses: actions/upload-artifact@v4
with:
name: release
retention-days: 1
path: release.tar

publish-linux-amd64:
runs-on: ubuntu-latest
needs: build
steps:
- uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: actions/download-artifact@v4
- run: tar xvf ./release/release.tar
- run: "docker build --pull --push --platform linux/amd64 -t ${{ env.IMAGE }}-linux-amd64 ."
working-directory: ./dist/aks-node-termination-handler_linux_amd64_v1

publish-linux-arm64:
runs-on: ubuntu-latest
needs: build
steps:
- uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: actions/download-artifact@v4
- run: tar xvf ./release/release.tar
- run: "docker build --pull --push --platform linux/arm64 -t ${{ env.IMAGE }}-linux-arm64 ."
working-directory: ./dist/aks-node-termination-handler_linux_arm64

publish-windows:
runs-on: windows-latest
needs: build
steps:
- uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: actions/download-artifact@v4
- run: tar xvf ./release/release.tar
- run: "docker build --pull --platform windows/amd64 -t ${{ env.IMAGE }}-windows-amd64 ."
working-directory: ./dist/aks-node-termination-handler_windows_amd64_v1
- run: docker push ${{ env.IMAGE }}-windows-amd64

publish-manifest:
runs-on: ubuntu-latest
needs: [publish-linux-amd64, publish-linux-arm64, publish-windows]
steps:
- uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- run: docker manifest create ${{ env.IMAGE }} ${{ env.IMAGE }}-linux-amd64 ${{ env.IMAGE }}-linux-arm64 ${{ env.IMAGE }}-windows-amd64
- run: docker manifest push ${{ env.IMAGE }}
27 changes: 21 additions & 6 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@ release:
docker_manifests:
- name_template: paskalmaksim/{{.ProjectName}}:latest
image_templates:
- paskalmaksim/{{.ProjectName}}:{{.Tag}}-amd64
- paskalmaksim/{{.ProjectName}}:{{.Tag}}-arm64
- paskalmaksim/{{.ProjectName}}:{{.Tag}}-linux-amd64
- paskalmaksim/{{.ProjectName}}:{{.Tag}}-linux-arm64
- paskalmaksim/{{.ProjectName}}:{{.Tag}}-windows-arm64
- name_template: paskalmaksim/{{.ProjectName}}:{{.Tag}}
image_templates:
- paskalmaksim/{{.ProjectName}}:{{.Tag}}-amd64
- paskalmaksim/{{.ProjectName}}:{{.Tag}}-arm64
- paskalmaksim/{{.ProjectName}}:{{.Tag}}-linux-amd64
- paskalmaksim/{{.ProjectName}}:{{.Tag}}-linux-arm64
- paskalmaksim/{{.ProjectName}}:{{.Tag}}-windows-arm64
dockers:
- use: buildx
goos: linux
goarch: amd64
image_templates:
- paskalmaksim/{{.ProjectName}}:{{.Tag}}-amd64
- paskalmaksim/{{.ProjectName}}:{{.Tag}}-linux-amd64
build_flag_templates:
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.created={{.Date}}"
Expand All @@ -29,13 +31,25 @@ dockers:
goos: linux
goarch: arm64
image_templates:
- paskalmaksim/{{.ProjectName}}:{{.Tag}}-arm64
- paskalmaksim/{{.ProjectName}}:{{.Tag}}-linux-arm64
build_flag_templates:
- "--platform=linux/arm64/v8"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- use: buildx
goos: windows
goarch: amd64
dockerfile: Dockerfile.windows
image_templates:
- paskalmaksim/{{.ProjectName}}:{{.Tag}}-windows-amd64
build_flag_templates:
- "--platform=windows/amd64"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
builds:
- dir: ./cmd/
env:
Expand All @@ -46,6 +60,7 @@ builds:
- -s -w -X github.com/maksim-paskal/aks-node-termination-handler/pkg/config.gitVersion={{.Version}}-{{.ShortCommit}}-{{.Timestamp}}
goos:
- linux
- windows
goarch:
- amd64
- arm64
Expand Down
7 changes: 7 additions & 0 deletions Dockerfile.windows
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM mcr.microsoft.com/windows/nanoserver:1809

WORKDIR /app/

COPY ./aks-node-termination-handler.exe /app/aks-node-termination-handler.exe

ENTRYPOINT [ "/app/aks-node-termination-handler.exe" ]

0 comments on commit cc07e22

Please sign in to comment.