8000 Add debian 10 (#250) · PowerShell/PowerShell-Docker@0dd056d · GitHub
[go: up one dir, main page]

Skip to content

Commit 0dd056d

Browse files
authored
Add debian 10 (#250)
1 parent 6cb3eb5 commit 0dd056d

File tree

7 files changed

+204
-1
lines changed

7 files changed

+204
-1
lines changed

release/preview/debian9/dependabot/Dockerfile renamed to release/preview/debian10/dependabot/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44
# Dummy docker image to trigger dependabot PRs
55

6-
FROM debian:9.9
6+
FROM debian:10
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# Docker image file that describes an Debian image with PowerShell installed from Microsoft APT Repo
2+
ARG fromTag=buster-slim
3+
ARG imageRepo=debian
4+
5+
FROM ${imageRepo}:${fromTag} AS installer-env
6+
7+
# Define Args for the needed to add the package
8+
ARG PS_VERSION=6.1.0
9+
ARG PS_PACKAGE=powershell-${PS_VERSION}-linux-x64.tar.gz
10+
ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE}
11+
ARG PS_INSTALL_VERSION=7-preview
12+
13+
# Download the Linux tar.gz and save it
14+
ADD ${PS_PACKAGE_URL} /tmp/linux.tar.gz
15+
16+
# define the folder we will be installing PowerShell to
17+
ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION
18+
19+
# Create the install folder
20+
RUN mkdir -p ${PS_INSTALL_FOLDER}
21+
22+
# Unzip the Linux tar.gz
23+
RUN tar zxf /tmp/linux.tar.gz -C ${PS_INSTALL_FOLDER}
24+
25+
# Start a new stage so we lose all the tar.gz layers from the final image
26+
FROM ${imageRepo}:${fromTag}
27+
28+
ARG PS_VERSION=6.2.0-preview.3
29+
ARG PS_INSTALL_VERSION=7-preview
30+
31+
# Copy only the files we need from the previous stage
32+
COPY --from=installer-env ["/opt/microsoft/powershell", "/opt/microsoft/powershell"]
33+
34+
# Define Args and Env needed to create links
35+
ARG PS_INSTALL_VERSION=7-preview
36+
ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \
37+
\
38+
# Define ENVs for Localization/Globalization
39+
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \
40+
LC_ALL=en_US.UTF-8 \
41+
LANG=en_US.UTF-8 \
42+
# set a fixed location for the Module analysis cache
43+
PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache
44+
45+
# Install dependencies and clean up
46+
RUN apt-get update \
47+
&& apt-get install -y \
48+
# less is required for help in powershell
49+
less \
50+
# requied to setup the locale
51+
locales \
52+
# required for SSL
53+
ca-certificates \
54+
gss-ntlmssp \
55+
libicu63 \
56+
libssl1.1 \
57+
libc6 \
58+
libgcc1 \
59+
libgssapi-krb5-2 \
60+
liblttng-ust0 \
61+
libstdc++6 \
62+
zlib1g \
63+
&& apt-get dist-upgrade -y \
64+
&& apt-get clean \
65+
&& rm -rf /var/lib/apt/lists/* \
66+
# enable en_US.UTF-8 locale
67+
&& sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen \
68+
# generate locale
69+
&& locale-gen && update-locale
70+
71+
# Give all user execute permissions and remove write permissions for others
72+
RUN chmod a+x,o-w ${PS_INSTALL_FOLDER}/pwsh \
73+
# Create the pwsh symbolic link that points to powershell
74+
&& ln -s ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh \
75+
# intialize powershell module cache
76+
&& pwsh \
77+
-NoLogo \
78+
-NoProfile \
79+
-Command " \
80+
\$ErrorActionPreference = 'Stop' ; \
81+
\$ProgressPreference = 'SilentlyContinue' ; \
82+
while(!(Test-Path -Path \$env:PSModuleAnalysisCachePath)) { \
83+
Write-Host "'Waiting for $env:PSModuleAnalysisCachePath'" ; \
84+
Start-Sleep -Seconds 6 ; \
85+
}"
86+
87+
# Define args needed only for the labels
88+
ARG VCS_REF="none"
89+
ARG IMAGE_NAME=mcr.microsoft.com/powershell:debian-10
90+
91+
LABEL maintainer="PowerShell Team <powershellteam@hotmail.com>" \
92+
readme.md="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" \
93+
description="This Dockerfile will install the latest release of PowerShell." \
94+
org.label-schema.usage="https://github.com/PowerShell/PowerShell/tree/master/docker#run-the-docker-image-you-built" \
95+
org.label-schema.url="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" \
96+
org.label-schema.vcs-url="https://github.com/PowerShell/PowerShell-Docker" \
97+
org.label-schema.name="powershell" \
98+
org.label-schema.vendor="PowerShell" \
99+
org.label-schema.version=${PS_VERSION} \
100+
org.label-schema.schema-version="1.0" \
101+
org.label-schema.vcs-ref=${VCS_REF} \
102+
org.label-schema.docker.cmd="docker run ${IMAGE_NAME} pwsh -c '$psversiontable'" \
103+
org.label-schema.docker.cmd.devel="docker run ${IMAGE_NAME}" \
104+
org.label-schema.docker.cmd.test="docker run ${IMAGE_NAME} pwsh -c Invoke-Pester" \
105+
org.label-schema.docker.cmd.help="docker run ${IMAGE_NAME} pwsh -c Get-Help"
106+
107+
# Use PowerShell as the default shell
108+
# Use array to avoid Docker prepending /bin/sh -c
109+
CMD [ "pwsh" ]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
# return objects representing the tags we need to base the debian image on Docker
5+
6+
# The versions of debian we care about
7+
$shortTags = @('buster-slim')
8+
9+
$parent = Join-Path -Path $PSScriptRoot -ChildPath '..'
10+
$repoRoot = Join-Path -path (Join-Path -Path $parent -ChildPath '..') -ChildPath '..'
11+
$modulePath = Join-Path -Path $repoRoot -ChildPath 'tools\getDockerTags'
12+
Import-Module $modulePath
13+
14+
Get-DockerTags -ShortTags $shortTags -Image "debian" -FullTagFilter 'buster-\d{8}[\.\d{1}]?-slim' -AlternativeShortTag '10' -SkipShortTagFilter

release/preview/debian10/meta.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"IsLinux" : true,
3+
"UseLinuxVersion" : false,
4+
"PackageFormat": "powershell-${PS_VERSION}-linux-x64.tar.gz",
5+
"osVersion": "Debian 10",
6+
"SkipGssNtlmSspTests": false,
7+
"tagTemplates": [
8+
"#psversion#-debian-#tag#",
9+
"preview-debian-#shorttag#"
10+
],
11+
"SubImage": "test-deps",
12+
"TestProperties": {
13+
"size": 314
14+
}
15+
}
16+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Docker image file that describes an Debian image with PowerShell and test dependencies
2+
ARG BaseImage=mcr.microsoft.com/powershell:preview-debian-10
3+
4+
FROM ${BaseImage}
5+
6+
# Install dependencies and clean up
7+
RUN apt-get update \
8+
&& apt-get install -y \
9+
sudo \
10+
curl \
11+
wget \
12+
iputils-ping \
13+
iputils-tracepath \
14+
procps \
15+
&& apt-get clean \
16+
&& rm -rf /var/lib/apt/lists/*
17+
18+
# Define args needed only for the labels
19+
ARG VCS_REF="none"
20+
ARG IMAGE_NAME=mcr.microsoft.com/powershell/test-deps:debian-9
21+
ARG PS_VERSION=6.2.0
22+
23+
LABEL maintainer="PowerShell Team <powershellteam@hotmail.com>" \
24+
readme.md="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" \
25+
description="This Dockerfile will install the latest release of PowerShell and tools needed for runing CI/CD container jobs." \
26+
org.label-schema.usage="https://github.com/PowerShell/PowerShell/tree/master/docker#run-the-docker-image-you-built" \
27+
org.label-schema.url="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" \
28+
org.label-schema.vcs-url="https://github.com/PowerShell/PowerShell-Docker" \
29+
org.label-schema.name="powershell" \
30+
org.label-schema.vendor="PowerShell" \
31+
org.label-schema.version=${PS_VERSION} \
32+
org.label-schema.schema-version="1.0" \
33+
org.label-schema.vcs-ref=${VCS_REF} \
34+
org.label-schema.docker.cmd="docker run ${IMAGE_NAME} pwsh -c '$psversiontable'" \
35+
org.label-schema.docker.cmd.devel="docker run ${IMAGE_NAME}" \
36+
org.label-schema.docker.cmd.test="docker run ${IMAGE_NAME} pwsh -c Invoke-Pester" \
37+
org.label-schema.docker.cmd.help="docker run ${IMAGE_NAME} pwsh -c Get-Help"
38+
39+
# Use PowerShell as the default shell
40+
# Use array to avoid Docker prepending /bin/sh -c
41+
CMD [ "pwsh" ]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"IsLinux" : true,
3+
"UseLinuxVersion": false,
4+
"osVersion": "Debian 10",
5+
"tagTemplates": [
6+
"preview-debian-#shorttag#"
7+
],
8+
"SubRepository": "test-deps",
9+
"OptionalTests": [
10+
"test-deps",
11+
"test-deps-debian"
12+
],
13+
"TestProperties": {
14+
"size": 316
15+
}
16+
}

vsts-ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ jobs:
8787
stable: true
8888
preview: true
8989

90+
- template: .vsts-ci/phase.yml
91+
parameters:
92+
name: debian10
93+
imagename: debian10
94+
stable: false
95+
preview: true
96+
9097
- template: .vsts-ci/phase.yml
9198
parameters:
9299
name: kaliRolling

0 commit comments

Comments
 (0)
0