-
Notifications
You must be signed in to change notification settings - Fork 9
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -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: | ||||||||
|
@@ -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 | ||||||||
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 | ||||||||
|
@@ -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 }} | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
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 | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. while we're at it: there is also |
||||||||
|
||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
# Set PATH environment variable | ||||||||
ENV PATH="C:\Pixi;${PATH}" | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.