Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build windows docker images #41

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
53 changes: 52 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ jobs:

release:
needs: [test, push]
outputs:
release_version: RELEASE_VERSION
runs-on: ubuntu-latest
# Only release when ref is a tag
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
Expand Down Expand Up @@ -196,8 +198,11 @@ jobs:

echo "${SERVICE_ACCOUNT_GITHUB_ACTIONS_RELEASE}" > /tmp/gs.json

go run mage.go deps release
release_version=$(echo '${{ github.ref }}' | sed 's|refs/tags/v||g')
echo "RELEASE_VERSION=${release_version}" >> $GITHUB_OUTPUT

go run mage.go deps release

msi:
needs: release
runs-on: windows-latest
Expand Down Expand Up @@ -251,3 +256,49 @@ jobs:
env:
MSI_FILE: ${{ steps.buildmsi.outputs.msi }}
GITHUB_TOKEN: ${{ steps.vault.outputs.ROOT_TOKEN }}

docker-windows:
needs: release
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 2
matrix:
os: [ windows-2019 ]
include:
- os: windows-2019
file: Dockerfile.windows
base: ltsc2019
tag: aserto-dev/topaz:${{ needs.release.outputs.release_version }}-windows-ltsc2019
latest: aserto-dev/topaz:latest-windows-ltsc2019
- os: windows-2022
file: Dockerfile.windows
base: ltsc2022
tag: aserto-dev/topaz:${{ needs.release.outputs.release_version }}-windows-ltsc2022
latest: aserto-dev/topaz:latest-windows-ltsc2022
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Read Configuration
uses: hashicorp/vault-action@v2.4.3
id: vault
with:
url: https://vault.eng.aserto.com/
token: ${{ secrets.VAULT_TOKEN }}
secrets: |
kv/data/github "USERNAME" | DOCKER_USERNAME;
kv/data/github "DOCKER_PUSH_TOKEN" | DOCKER_PASSWORD;

- name: Login to GitHub Packages Docker Registry
uses: docker/login-action@v2
with:
registry: https://ghcr.io
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}

- name: Docker Build
run: |
docker build . -t ${{ matrix.tag }} -f ${{ matrix.file }} --build-arg BASE=${{ matrix.base }} --build-arg VERSION="${{ needs.release.outputs.release_version }}" --build-arg COMMIT="${{ github.sha }}"
- name: Docker push
run: |
docker tag ${{ matrix.tag }} ${{ matrix.latest }}
docker push ${{ matrix.tag }} ${{ matrix.latest }}
29 changes: 29 additions & 0 deletions Dockerfile.windows
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# escape=`
ARG BASE
ARG VERSION
ARG COMMIT

ENV VERSION=$VERSION

FROM mcr.microsoft.com/windows/servercore:$BASE

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

RUN Invoke-WebRequest ('https://github.com/aserto-dev/topaz/releases/download/v{0}/topaz_windows_x86_64.zip' -f $env:VERSION) -OutFile 'topaz_windows_x86_64.zip' -UseBasicParsing ; `
mkdir C:\Topaz ; `
Expand-Archive topaz_windows_x86_64.zip -DestinationPath C:\Topaz ; `
Remove-Item -Path topaz_windows_x86_64.zip

LABEL org.opencontainers.image.version=$VERSION
LABEL org.opencontainers.image.source=https://github.com/aserto-dev/topaz
LABEL org.opencontainers.image.title="Topaz"
LABEL org.opencontainers.image.revision=$COMMIT
LABEL org.opencontainers.image.url=https://aserto.com

EXPOSE 8282
EXPOSE 8383
EXPOSE 8484
EXPOSE 8585
EXPOSE 9292

CMD [ "C:\\Topaz\\topazd.exe" ]