Skip to content
Merged
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
16 changes: 12 additions & 4 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ function Get-EnvironmentInformation
$environment += @{'IsOpenSUSE42.1' = $Environment.IsOpenSUSE -and $LinuxInfo.VERSION_ID -match '42.1'}
$environment += @{'IsRedHatFamily' = $Environment.IsCentOS -or $Environment.IsFedora -or $Environment.IsRedHat}
$environment += @{'IsSUSEFamily' = $Environment.IsSLES -or $Environment.IsOpenSUSE}
$environment += @{'IsAlpine' = $LinuxInfo.ID -match 'alpine'}

# Workaround for temporary LD_LIBRARY_PATH hack for Fedora 24
# https://github.com/PowerShell/PowerShell/issues/2511
Expand All @@ -160,7 +161,8 @@ function Get-EnvironmentInformation
$environment.IsDebian -or
$environment.IsUbuntu -or
$environment.IsRedHatFamily -or
$environment.IsSUSEFamily)
$environment.IsSUSEFamily -or
$environment.IsAlpine)
) {
throw "The current OS : $($LinuxInfo.ID) is not supported for building PowerShell."
}
Expand Down Expand Up @@ -224,7 +226,7 @@ function Start-PSBuild {
# If this parameter is not provided it will get determined automatically.
[ValidateSet("fxdependent",
"linux-arm",
"linux-musl-x64",
"alpine-x64",
"linux-x64",
"osx-x64",
"win-arm",
Expand Down Expand Up @@ -594,7 +596,7 @@ function New-PSOptions {
[ValidateSet("",
"fxdependent",
"linux-arm",
"linux-musl-x64",
"alpine-x64",
"linux-x64",
"osx-x64",
"win-arm",
Expand Down Expand Up @@ -1633,6 +1635,12 @@ function Start-PSBootstrap {

# Install patched version of curl
Start-NativeExecution { brew install curl --with-openssl --with-gssapi } -IgnoreExitcode
} elseif ($Environment.IsAlpine) {
$Deps += 'libunwind', 'libcurl', 'bash', 'cmake', 'clang', 'build-base', 'git', 'curl'

Start-NativeExecution {
Invoke-Expression "apk add $Deps"
}
}

# Install [fpm](https://github.com/jordansissel/fpm) and [ronn](https://github.com/rtomayko/ronn)
Expand Down Expand Up @@ -2054,7 +2062,7 @@ function Start-CrossGen {

[Parameter(Mandatory=$true)]
[ValidateSet("linux-arm",
"linux-musl-x64",
"alpine-x64",
"linux-x64",
"osx-x64",
"win-arm",
Expand Down
18 changes: 9 additions & 9 deletions tools/packaging/packaging.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function Start-PSPackage {
[string]$Name = "powershell",

# Ubuntu, CentOS, Fedora, macOS, and Windows packages are supported
[ValidateSet("deb", "osxpkg", "rpm", "msi", "zip", "AppImage", "nupkg", "tar", "tar-arm", 'tar-musl', 'fxdependent')]
[ValidateSet("deb", "osxpkg", "rpm", "msi", "zip", "AppImage", "nupkg", "tar", "tar-arm", 'tar-alpine', 'fxdependent')]
[string[]]$Type,

# Generate windows downlevel package
Expand Down Expand Up @@ -67,8 +67,8 @@ function Start-PSPackage {
$WindowsRuntime, "Release"
} elseif ($Type -eq "tar-arm") {
New-PSOptions -Configuration "Release" -Runtime "Linux-ARM" -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration }
} elseif ($Type -eq "tar-musl") {
New-PSOptions -Configuration "Release" -Runtime "Linux-musl-x64" -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration }
} elseif ($Type -eq "tar-alpine") {
New-PSOptions -Configuration "Release" -Runtime "alpine-x64" -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration }
} else {
New-PSOptions -Configuration "Release" -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration }
}
Expand Down Expand Up @@ -112,7 +112,7 @@ function Start-PSPackage {
$PSModuleRestoreCorrect = $true
}

$precheckFailed = if ($Type -eq 'fxdependent') {
$precheckFailed = if ($Type -eq 'fxdependent' -or $Type -eq 'tar-alpine') {
## We do not check for runtime and crossgen for framework dependent package.
-not $Script:Options -or ## Start-PSBuild hasn't been executed yet
-not $PSModuleRestoreCorrect -or ## Last build didn't specify '-PSModuleRestore' correctly
Expand Down Expand Up @@ -376,13 +376,13 @@ function Start-PSPackage {
New-TarballPackage @Arguments
}
}
"tar-musl" {
"tar-alpine" {
$Arguments = @{
PackageSourcePath = $Source
Name = $Name
Version = $Version
Force = $Force
Architecture = "musl-x64"
Architecture = "alpine-x64"
}

if ($PSCmdlet.ShouldProcess("Create tar.gz Package")) {
Expand Down Expand Up @@ -1499,7 +1499,7 @@ function New-UnifiedNugetPackage
[string] $LinuxArm32BinPath,

[Parameter(Mandatory = $false)]
[string] $LinuxMuslBinPath,
[string] $LinuxAlpineBinPath,

[Parameter(Mandatory = $true)]
[string] $LinuxBinPath,
Expand Down Expand Up @@ -1568,9 +1568,9 @@ function New-UnifiedNugetPackage
{
CreateNugetPlatformFolder -Platform 'linux-arm' -PackageRuntimesFolder $packageRuntimesFolderPath -PlatformBinPath $linuxArm32BinPath

if ($linuxMuslBinPath)
if ($linuxAlpineBinPath)
{
CreateNugetPlatformFolder -Platform 'linux-musl-x64' -PackageRuntimesFolder $packageRuntimesFolderPath -PlatformBinPath $linuxMuslBinPath
CreateNugetPlatformFolder -Platform 'alpine-x64' -PackageRuntimesFolder $packageRuntimesFolderPath -PlatformBinPath $LinuxAlpineBinPath
}

CreateNugetPlatformFolder -Platform 'linux-x64' -PackageRuntimesFolder $packageRuntimesFolderPath -PlatformBinPath $linuxBinPath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ param (
[switch]$AppImage,
[switch]$TarX64,
[switch]$TarArm,
[switch]$FxDependent
[switch]$FxDependent,
[switch]$Alpine
)

$releaseTagParam = @{}
Expand All @@ -39,6 +40,8 @@ try {

if($FxDependent.IsPresent) {
$buildParams.Add("Runtime", "fxdependent")
} elseif ($Alpine.IsPresent) {
$buildParams.Add("Runtime", 'alpine-x64')
} else {
$buildParams.Add("Crossgen", $true)
}
Expand All @@ -47,6 +50,8 @@ try {

if($FxDependent) {
Start-PSPackage -Type 'fxdependent' @releaseTagParam
} elseif ($Alpine) {
Start-PSPackage -Type 'tar-alpine' @releaseTagParam
} else {
Start-PSPackage @releaseTagParam
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# Docker image file that describes an Centos7 image with PowerShell installed from Microsoft YUM Repo

FROM microsoft/dotnet:2.1-sdk-alpine
FROM mcr.microsoft.com/powershell:6.1.0-alpine-3.8
LABEL maintainer="PowerShell Team <powershellteam@hotmail.com>"

# Install dependencies and clean up
RUN apk update \
&& apk add cmake clang build-base git bash
&& apk add libunwind libcurl cmake clang build-base git bash curl

COPY PowerShellPackage.ps1 /

ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1

COPY build-and-run-pwsh.sh /
ENTRYPOINT [ "pwsh" ]

This file was deleted.

4 changes: 2 additions & 2 deletions tools/releaseBuild/build.json
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@
{
"Name": "alpine.3",
"RepoDestinationPath": "/PowerShell",
"BuildCommand": "/build-and-run-pwsh.sh _RepoDestinationPath_ _DockerVolume_ _ReleaseTag_",
"AdditionalContextFiles" :[ "./tools/releaseBuild/Images/microsoft_powershell_alpine3/build-and-run-pwsh.sh"],
"BuildCommand": "/PowerShellPackage.ps1 -location _RepoDestinationPath_ -destination _DockerVolume_ -ReleaseTag _ReleaseTag_ -Alpine",
"AdditionalContextFiles" :[ "./tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1"],
"DockerFile": "./tools/releaseBuild/Images/microsoft_powershell_alpine3/Dockerfile",
"DockerImageName": "ps-alpine-3",
"BinaryBucket": "release"
Expand Down