Skip to content
This repository has been archived by the owner on Jul 6, 2023. It is now read-only.

Windows Container for building Nim applications

License

Notifications You must be signed in to change notification settings

sirredbeard/nim-windows-container

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Untitled3

Nim Windows Container

This repository contains:

  • A Dockerfile that builds a Windows Server Core Container with Nim, MinGit, and Mingw-w64 dependencies as a starting point for building Nim applications in Windows Containers.
  • A GitHub Actions workflow for deploying the Windows Container to the GitHub Container Registry.

Nim

Nim is a compiled, garbage-collected systems programming language with a design that focuses on efficiency, expressiveness, and elegance.

Dockerfile

The sample Dockerfile defaults to:

  • Windows Server 2022 LTSC.
  • Nim 1.6.12, the current stable release of Nim. It is very likely by the time you are reading this that Nim has since been updated. Check nim-lang releases for the latest release. See the GitHub Actions below for how the latest version is automatically pulled in to the Windows Container published here.

GitHub Actions Workflow

The sample GitHub Actions workflow:

  • Builds the Windows Container for and Windows Server 2022 LTSC.
  • Detects and downloads the latest version of Nim by communicating with the GitHub REST API: $nim_version = ((Invoke-RestMethod -Uri https://api.github.com/repos/nim-lang/Nim/tags).Name | Select-Object -first 1).Trim("v") and passing the most recent version into the Dockerfile as a build argument: --build-arg nim_version=$nim_version, overriding the default of 1.6.12.
  • Pushes the resulting container to the GitHub Container Registry.

It is not currently possible to run Windows Containers on GitHub Actions at this time, the runner only supports Linux containers. :(

Windows Container

Prerequisites for Windows Containers

To use the Windows Container, you'll need:

  • Windows 10/11 Pro or Enterprise editions or Windows Server 2022
  • To enable Windows Containers:

As Administator, open PowerShell, and enable Windows Containers:

Enable-WindowsOptionalFeature -Online -FeatureName containers –All

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V –All

Windows Server 2022 Core LTSC base

To get the Windows Container:

docker pull ghcr.io/sirredbeard/nim-windows-container/nimstable-ltsc2022:latest

To start the Windows Container on pause, so you can exec in:

docker run ghcr.io/sirredbeard/nim-windows-container/nimstable-ltsc2022:latest pause.exe

Also see the GitHub Container Registry page.

Build Yourself

To build and use the Windows Container yourself, you can use the Dockerfile and build locally, or:

image

  • Run:
Set-Variable -Name "CR_PAT" -Value "<PAT>"
echo $CR_PAT | docker login ghcr.io -u USERNAME --password-stdin
docker pull ghcr.io/<USERNAME>/nim-windows-container/nimstable-ltsc2019:latest``