Skip to content

Add Debian 10 #250

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

Merged
merged 1 commit into from
Jul 30, 2019
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

# Dummy docker image to trigger dependabot PRs

FROM debian:9.9
FROM debian:10
109 changes: 109 additions & 0 deletions release/preview/debian10/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Docker image file that describes an Debian image with PowerShell installed from Microsoft APT Repo
ARG fromTag=buster-slim
ARG imageRepo=debian

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

# Define Args for the needed to add the package
ARG PS_VERSION=6.1.0
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=7-preview

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

# define the folder we will be installing PowerShell to
ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION

# Create the install folder
RUN mkdir -p ${PS_INSTALL_FOLDER}

# Unzip the Linux tar.gz
RUN tar zxf /tmp/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}

ARG PS_VERSION=6.2.0-preview.3
ARG PS_INSTALL_VERSION=7-preview

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

# Define Args and Env needed to create links
ARG PS_INSTALL_VERSION=7-preview
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 \
# set a fixed location for the Module analysis cache
PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache

# Install dependencies and clean up
RUN apt-get update \
&& apt-get install -y \
# less is required for help in powershell
less \
# requied to setup the locale
locales \
# required for SSL
ca-certificates \
gss-ntlmssp \
libicu63 \
libssl1.1 \
libc6 \
libgcc1 \
libgssapi-krb5-2 \
liblttng-ust0 \
libstdc++6 \
zlib1g \
&& apt-get dist-upgrade -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
# enable en_US.UTF-8 locale
&& sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen \
# generate locale
&& locale-gen && update-locale

# Give all user execute permissions and remove write permissions for others
RUN chmod a+x,o-w ${PS_INSTALL_FOLDER}/pwsh \
# Create the pwsh symbolic link that points to powershell
&& ln -s ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh \
# intialize powershell module cache
&& pwsh \
-NoLogo \
-NoProfile \
-Command " \
\$ErrorActionPreference = 'Stop' ; \
\$ProgressPreference = 'SilentlyContinue' ; \
while(!(Test-Path -Path \$env:PSModuleAnalysisCachePath)) { \
Write-Host "'Waiting for $env:PSModuleAnalysisCachePath'" ; \
Start-Sleep -Seconds 6 ; \
}"

# Define args needed only for the labels
ARG VCS_REF="none"
ARG IMAGE_NAME=mcr.microsoft.com/powershell:debian-10

LABEL maintainer="PowerShell Team <powershellteam@hotmail.com>" \
readme.md="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" \
description="This Dockerfile will install the latest release of PowerShell." \
org.label-schema.usage="https://github.com/PowerShell/PowerShell/tree/master/docker#run-the-docker-image-you-built" \
org.label-schema.url="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" \
org.label-schema.vcs-url="https://github.com/PowerShell/PowerShell-Docker" \
org.label-schema.name="powershell" \
org.label-schema.vendor="PowerShell" \
org.label-schema.version=${PS_VERSION} \
org.label-schema.schema-version="1.0" \
org.label-schema.vcs-ref=${VCS_REF} \
org.label-schema.docker.cmd="docker run ${IMAGE_NAME} pwsh -c '$psversiontable'" \
org.label-schema.docker.cmd.devel="docker run ${IMAGE_NAME}" \
org.label-schema.docker.cmd.test="docker run ${IMAGE_NAME} pwsh -c Invoke-Pester" \
org.label-schema.docker.cmd.help="docker run ${IMAGE_NAME} pwsh -c Get-Help"

# Use PowerShell as the default shell
# Use array to avoid Docker prepending /bin/sh -c
CMD [ "pwsh" ]
14 changes: 14 additions & 0 deletions release/preview/debian10/getLatestTag.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

# return objects representing the tags we need to base the debian image on Docker

# The versions of debian we care about
$shortTags = @('buster-slim')

$parent = Join-Path -Path $PSScriptRoot -ChildPath '..'
$repoRoot = Join-Path -path (Join-Path -Path $parent -ChildPath '..') -ChildPath '..'
$modulePath = Join-Path -Path $repoRoot -ChildPath 'tools\getDockerTags'
Import-Module $modulePath

Get-DockerTags -ShortTags $shortTags -Image "debian" -FullTagFilter 'buster-\d{8}[\.\d{1}]?-slim' -AlternativeShortTag '10' -SkipShortTagFilter
16 changes: 16 additions & 0 deletions release/preview/debian10/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"IsLinux" : true,
"UseLinuxVersion" : false,
"PackageFormat": "powershell-${PS_VERSION}-linux-x64.tar.gz",
"osVersion": "Debian 10",
"SkipGssNtlmSspTests": false,
"tagTemplates": [
"#psversion#-debian-#tag#",
"preview-debian-#shorttag#"
],
"SubImage": "test-deps",
"TestProperties": {
"size": 314
}
}

41 changes: 41 additions & 0 deletions release/preview/debian10/test-deps/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Docker image file that describes an Debian image with PowerShell and test dependencies
ARG BaseImage=mcr.microsoft.com/powershell:preview-debian-10

FROM ${BaseImage}

# Install dependencies and clean up
RUN apt-get update \
&& apt-get install -y \
sudo \
curl \
wget \
iputils-ping \
iputils-tracepath \
procps \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Define args needed only for the labels
ARG VCS_REF="none"
ARG IMAGE_NAME=mcr.microsoft.com/powershell/test-deps:debian-9
ARG PS_VERSION=6.2.0

LABEL maintainer="PowerShell Team <powershellteam@hotmail.com>" \
readme.md="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" \
description="This Dockerfile will install the latest release of PowerShell and tools needed for runing CI/CD container jobs." \
org.label-schema.usage="https://github.com/PowerShell/PowerShell/tree/master/docker#run-the-docker-image-you-built" \
org.label-schema.url="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" \
org.label-schema.vcs-url="https://github.com/PowerShell/PowerShell-Docker" \
org.label-schema.name="powershell" \
org.label-schema.vendor="PowerShell" \
org.label-schema.version=${PS_VERSION} \
org.label-schema.schema-version="1.0" \
org.label-schema.vcs-ref=${VCS_REF} \
org.label-schema.docker.cmd="docker run ${IMAGE_NAME} pwsh -c '$psversiontable'" \
org.label-schema.docker.cmd.devel="docker run ${IMAGE_NAME}" \
org.label-schema.docker.cmd.test="docker run ${IMAGE_NAME} pwsh -c Invoke-Pester" \
org.label-schema.docker.cmd.help="docker run ${IMAGE_NAME} pwsh -c Get-Help"

# Use PowerShell as the default shell
# Use array to avoid Docker prepending /bin/sh -c
CMD [ "pwsh" ]
16 changes: 16 additions & 0 deletions release/preview/debian10/test-deps/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"IsLinux" : true,
"UseLinuxVersion": false,
"osVersion": "Debian 10",
"tagTemplates": [
"preview-debian-#shorttag#"
],
"SubRepository": "test-deps",
"OptionalTests": [
"test-deps",
"test-deps-debian"
],
"TestProperties": {
"size": 316
}
}
7 changes: 7 additions & 0 deletions vsts-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ jobs:
stable: true
preview: true

- template: .vsts-ci/phase.yml
parameters:
name: debian10
imagename: debian10
stable: false
preview: true

- template: .vsts-ci/phase.yml
parameters:
name: kaliRolling
Expand Down