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 servercore image #58

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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 77 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ jobs:
- nvidia/cuda:11.2.2-base-ubuntu20.04
steps:
- name: Checkout source
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Set image variables
id: image-variables
env:
Expand Down Expand Up @@ -146,8 +147,81 @@ jobs:
- name: Image digest
run: echo ${{ steps.build.outputs.digest }}

build-windows:
needs: version
runs-on: windows-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
base-image:
- mcr.microsoft.com/windows/servercore:ltsc2022
steps:
- name: Checkout source
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Set image variables
id: image-variables
run: |
$baseImage = "${{ matrix.base-image }}"
$tag = "servercore"
echo "tag=$tag" >> $env:GITHUB_OUTPUT
shell: pwsh

- name: Login to GHCR
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0

with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
pavelzw marked this conversation as resolved.
Show resolved Hide resolved
env:
PIXI_VERSION: ${{ needs.version.outputs.new-version }}
run: |
$baseImage = "${{ matrix.base-image }}"
$tag = "${{ steps.image-variables.outputs.tag }}"
# Build the image
docker build `
--build-arg PIXI_VERSION=$env:PIXI_VERSION `
--build-arg BASE_IMAGE=$baseImage `
-t ghcr.io/prefix-dev/pixi:$env:PIXI_VERSION-$tag `
-f Dockerfile.windows .
shell: pwsh

- name: Test image
run: |
$tag = "${{ steps.image-variables.outputs.tag }}"
$version = "${{ needs.version.outputs.new-version }}"

# Test Pixi version
docker run --rm ghcr.io/prefix-dev/pixi:${version}-${tag} pixi --version
if ($LASTEXITCODE -ne 0) {
Write-Error "Pixi version check failed"
exit 1
}
# Test Python installation
docker run --rm ghcr.io/prefix-dev/pixi:${version}-${tag} `
cmd /c "mkdir C:\app && cd C:\app && pixi init && pixi add python && pixi run python --version"
if ($LASTEXITCODE -ne 0) {
Write-Error "Python installation and test failed"
exit 1
}
shell: pwsh

- name: push image
if: needs.version.outputs.push == 'true'
run: |
docker push ghcr.io/prefix-dev/pixi:$env:PIXI_VERSION-$tag

- name: Image digest
run: docker inspect ghcr.io/prefix-dev/pixi:${{ needs.version.outputs.new-version }}-${{ steps.image-variables.outputs.tag }} --format '{{.RepoDigests}}'
shell: pwsh

release:
needs: [version, build]
needs: [version, build, build-windows]
runs-on: ubuntu-22.04
permissions:
contents: write
Expand All @@ -162,4 +236,4 @@ jobs:
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
tag_name: ${{ needs.version.outputs.new-version }}
tag_name: ${{ needs.version.outputs.new-version }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
tag_name: ${{ needs.version.outputs.new-version }}
tag_name: ${{ needs.version.outputs.new-version }}

15 changes: 15 additions & 0 deletions Dockerfile.windows
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# escape=`

ARG BASE_IMAGE
FROM ${BASE_IMAGE}

ARG PIXI_VERSION

# Create a directory for Pixi
RUN mkdir C:\Pixi

# Download Pixi
ADD https://github.com/prefix-dev/pixi/releases/download/v${PIXI_VERSION}/pixi-x86_64-pc-windows-msvc.exe C:\Pixi\pixi.exe
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while we're at it: there is also https://github.com/prefix-dev/pixi/releases/download/v0.39.0/pixi-aarch64-pc-windows-msvc.exe. wdyt of doing a multi-arch build on windows as well similar to linux?


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

# Set PATH environment variable
ENV PATH="C:\Pixi;${PATH}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ENV PATH="C:\Pixi;${PATH}"
ENV PATH="C:\Pixi;${PATH}"

Loading