Skip to content

Commit

Permalink
Updated ClearLinux (#429)
Browse files Browse the repository at this point in the history
  • Loading branch information
kiazhi authored May 22, 2020
1 parent 806398d commit 957490e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,69 +4,18 @@
# Docker image file that describes an Intel Clear Linux image with PowerShell
# installed from full PowerShell linux tar.gz package

# Define arg(s) needed for the From statement
ARG fromTag=base
ARG imageRepo=clearlinux

FROM ${imageRepo}:${fromTag} AS installer-env
FROM clearlinux:latest AS installer-env

# Define Args for the needed to add the package
ARG PS_VERSION=6.1.0
ARG PS_VERSION=7.0.1
ARG PS_PACKAGE=powershell-${PS_VERSION}-linux-x64.tar.gz
ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE}
ARG PS_INSTALL_VERSION=6
ARG PS_INSTALL_VERSION=7

# Download the PowerShell Core Linux tar.gz and save it
ADD ${PS_PACKAGE_URL} /tmp/powershell-linux.tar.gz

# Define Args for the needed to add the package
ARG GNU_LINUX_LESS_PACKAGE_URL=https://ftp.gnu.org/gnu/less/less-530.tar.gz

# Download the less tar.gz and save it
ADD ${GNU_LINUX_LESS_PACKAGE_URL} /tmp/less.tar.gz

# Define Args and Env needed to create links
ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \
\
# Define ENVs for Localization/Globalization
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \
LC_ALL=en_US.UTF-8 \
LANG=en_US.UTF-8

# Installation
RUN \
# generate trust store
clrtrust generate -f \
# install dependencies
&& swupd bundle-add \
# required libstdc++.so.6
# required bundle to make less executable
os-core-dev \
# required libcrypto.so.1.0.0
# required libssl.so.1.0.0
# required these files to be copied to second stage
cryptoprocessor-management \
# create less folder
&& mkdir -p /tmp/less \
# uncompress GNU/Linux less tar file
&& tar zxf /tmp/less.tar.gz -C /tmp/less --strip-components 1 \
# make less executable
&& ./tmp/less/configure \
# create powershell folder
&& mkdir -p ${PS_INSTALL_FOLDER} \
# uncompress powershell linux tar file
&& tar zxf /tmp/powershell-linux.tar.gz -C ${PS_INSTALL_FOLDER}

# Start a new stage so we lose all the tar.gz layers from the final image
FROM ${imageRepo}:${fromTag}

# Copy only the files we need from the previous stage
COPY --from=installer-env ["/usr/bin/less", "/usr/bin/less"]
COPY --from=installer-env ["/opt/microsoft/powershell", "/opt/microsoft/powershell"]

# Define Args and Env needed to create links
ARG PS_VERSION=6.1.0
ARG PS_INSTALL_VERSION=6
ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \
\
# Define ENVs for Localization/Globalization
Expand All @@ -79,13 +28,15 @@ ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \
DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0 \
POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-ClearLinux-${fromTag}

# Installation
RUN \
# generate trust store
clrtrust generate -f \
# install dependencies
&& swupd bundle-add \
# required package for International Components for Unicode
runtime-libs-boost \
swupd bundle-add \
less \
# create powershell folder
&& mkdir -p ${PS_INSTALL_FOLDER} \
# uncompress powershell linux tar file
&& tar zxf /tmp/powershell-linux.tar.gz -C ${PS_INSTALL_FOLDER} \
# Create the pwsh symbolic link that points to powershell
&& ln -s ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh \
# intialize powershell module cache
Expand All @@ -104,13 +55,8 @@ RUN \
# clean downloaded packages
&& swupd clean --all

# Copy only the files we need from the previous stage after distro upgrade
# These files are required to resolve SSL issue with Invoke-WebRequest
COPY --from=installer-env ["/usr/lib64/libcrypto.so.1.0.0", "/usr/lib64/libcrypto.so.1.0.0"]
COPY --from=installer-env ["/usr/lib64/libssl.so.1.0.0", "/usr/lib64/libssl.so.1.0.0"]

# Define args needed only for the labels
ARG IMAGE_NAME=pshorg/powershellcommunity:clearlinux-base
ARG IMAGE_NAME=pshorg/powershellcommunity:clearlinux-latest
ARG VCS_REF="none"

# Add label last as it's just metadata and uses a lot of parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
"IsLinux" : true,
"PackageFormat": "powershell-${PS_VERSION}-linux-x64.tar.gz",
"SkipGssNtlmSspTests": true,
"IsBroken": true,
"shortTags": [
{"Tag": "latest"}
],
"tagTemplates": [
"#psversion#-clearlinux-#tag#",
"clearlinux-#shorttag#"
],
"continueOnError": true
"clearlinux"
]
}
14 changes: 0 additions & 14 deletions release/unstable/clearlinux/getLatestTag.ps1

This file was deleted.

0 comments on commit 957490e

Please sign in to comment.