Skip to content

Commit 5af45ad

Browse files
committed
Enhancement: Remove <distro> in docker tag for alpine variants
1 parent 6dcfdeb commit 5af45ad

40 files changed

+681
-112
lines changed

.github/workflows/ci-master-pr.yml

Lines changed: 93 additions & 93 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,28 @@ Dockerized `powershell`, based on [mcr.microsoft.com/powershell](https://hub.doc
88

99
## Tags
1010

11+
Variants without a distro are based on `alpine`.
12+
1113
| Tag | Dockerfile Build Context |
1214
|:-------:|:---------:|
13-
| `:7.3-alpine-3.17` | [View](variants/7.3-alpine-3.17) |
14-
| `:7.3-alpine-3.17-git` | [View](variants/7.3-alpine-3.17-git) |
15-
| `:7.3-alpine-3.17-git-sops` | [View](variants/7.3-alpine-3.17-git-sops) |
16-
| `:7.2-alpine-3.17` | [View](variants/7.2-alpine-3.17) |
17-
| `:7.2-alpine-3.17-git` | [View](variants/7.2-alpine-3.17-git) |
18-
| `:7.2-alpine-3.17-git-sops` | [View](variants/7.2-alpine-3.17-git-sops) |
19-
| `:7.1.5-alpine-3.13` | [View](variants/7.1.5-alpine-3.13) |
20-
| `:7.1.5-alpine-3.13-git` | [View](variants/7.1.5-alpine-3.13-git) |
21-
| `:7.1.5-alpine-3.13-git-sops` | [View](variants/7.1.5-alpine-3.13-git-sops) |
22-
| `:7.0.3-alpine-3.9` | [View](variants/7.0.3-alpine-3.9) |
23-
| `:7.0.3-alpine-3.9-git` | [View](variants/7.0.3-alpine-3.9-git) |
24-
| `:7.0.3-alpine-3.9-git-sops` | [View](variants/7.0.3-alpine-3.9-git-sops) |
25-
| `:6.2.4-alpine-3.8` | [View](variants/6.2.4-alpine-3.8) |
26-
| `:6.2.4-alpine-3.8-git` | [View](variants/6.2.4-alpine-3.8-git) |
27-
| `:6.2.4-alpine-3.8-git-sops` | [View](variants/6.2.4-alpine-3.8-git-sops) |
28-
| `:6.1.3-alpine-3.8` | [View](variants/6.1.3-alpine-3.8) |
29-
| `:6.1.3-alpine-3.8-git` | [View](variants/6.1.3-alpine-3.8-git) |
30-
| `:6.1.3-alpine-3.8-git-sops` | [View](variants/6.1.3-alpine-3.8-git-sops) |
15+
| `:7.3` | [View](variants/7.3) |
16+
| `:7.3-git` | [View](variants/7.3-git) |
17+
| `:7.3-git-sops` | [View](variants/7.3-git-sops) |
18+
| `:7.2` | [View](variants/7.2) |
19+
| `:7.2-git` | [View](variants/7.2-git) |
20+
| `:7.2-git-sops` | [View](variants/7.2-git-sops) |
21+
| `:7.1` | [View](variants/7.1) |
22+
| `:7.1-git` | [View](variants/7.1-git) |
23+
| `:7.1-git-sops` | [View](variants/7.1-git-sops) |
24+
| `:7.0` | [View](variants/7.0) |
25+
| `:7.0-git` | [View](variants/7.0-git) |
26+
| `:7.0-git-sops` | [View](variants/7.0-git-sops) |
27+
| `:6.2` | [View](variants/6.2) |
28+
| `:6.2-git` | [View](variants/6.2-git) |
29+
| `:6.2-git-sops` | [View](variants/6.2-git-sops) |
30+
| `:6.1` | [View](variants/6.1) |
31+
| `:6.1-git` | [View](variants/6.1-git) |
32+
| `:6.1-git-sops` | [View](variants/6.1-git-sops) |
3133
| `:7.3-ubuntu-22.04`, `:latest` | [View](variants/7.3-ubuntu-22.04) |
3234
| `:7.3-ubuntu-22.04-git` | [View](variants/7.3-ubuntu-22.04-git) |
3335
| `:7.3-ubuntu-22.04-git-sops` | [View](variants/7.3-ubuntu-22.04-git-sops) |

generate/definitions/VARIANTS.ps1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,14 @@ $VARIANTS = @(
4848
}
4949
# Docker image tag. E.g. '7.1.5-alpine-3.13'
5050
tag = @(
51-
$variant['base_image_tag'] -replace '^lts-', '' -replace '-\d{8}$', '' # Replace 'lts-' prefix and 8-digit calver suffix
51+
if ($variant['base_image_tag'] -match '^(lts-)?(\d+\.\d+)(\.\d+)?-(alpine|ubuntu)-(\d+\.\d+)') {
52+
if ($matches[4] -eq 'alpine') {
53+
$matches[2] # Only the version number
54+
}
55+
if ($matches[4] -eq 'ubuntu') {
56+
"$( $matches[2] )$( $matches[3] )-$( $matches[4] )-$( $matches[5] )" # Strip 'lts-' prefix and 8-digit calver suffix
57+
}
58+
}
5259
$subVariant['components'] | ? { $_ }
5360
) -join '-'
5461
tag_as_latest = if ($variant['base_image_tag'] -eq $local:BASE_IMAGE_TAG_LATEST_STABLE -and $subVariant['components'].Count -eq 0) { $true } else { $false }

generate/templates/README.md.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Dockerized ``powershell``, based on [mcr.microsoft.com/powershell](https://hub.d
99
1010
## Tags
1111
12+
Variants without a distro are based on ``alpine``.
13+
1214
| Tag | Dockerfile Build Context |
1315
|:-------:|:---------:|
1416
$(

variants/6.1-git-sops/Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FROM mcr.microsoft.com/powershell:6.1.3-alpine-3.8
2+
3+
# Disable telemetry for powershell 7.0.0 and above and .NET core: https://github.com/PowerShell/PowerShell/issues/16234#issuecomment-942139350
4+
ENV POWERSHELL_CLI_TELEMETRY_OPTOUT=1
5+
ENV POWERSHELL_TELEMETRY_OPTOUT=1
6+
ENV POWERSHELL_UPDATECHECK=Off
7+
ENV POWERSHELL_UPDATECHECK_OPTOUT=1
8+
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
9+
ENV DOTNET_TELEMETRY_OPTOUT=1
10+
ENV COMPlus_EnableDiagnostics=0
11+
12+
# Install Pester
13+
RUN pwsh -c 'Install-Module Pester -Scope AllUsers -MinimumVersion 4.0.0 -MaximumVersion 4.10.1 -Force -ErrorAction Stop -Verbose'
14+
RUN pwsh -c 'Install-Module Pester -Scope AllUsers -MinimumVersion 5.0.0 -Force -ErrorAction Stop -Verbose'
15+
16+
RUN apk add --no-cache git
17+
18+
RUN set -eux; \
19+
wget -qO- https://github.com/mozilla/sops/releases/download/v3.7.1/sops-v3.7.1.linux > /usr/local/bin/sops; \
20+
chmod +x /usr/local/bin/sops; \
21+
sha256sum /usr/local/bin/sops | grep '^185348fd77fc160d5bdf3cd20ecbc796163504fd3df196d7cb29000773657b74 '; \
22+
sops --version
23+
24+
RUN apk add --no-cache gnupg
25+
26+
COPY docker-entrypoint.sh /docker-entrypoint.sh
27+
RUN chmod +x docker-entrypoint.sh
28+
29+
ENTRYPOINT [ "/docker-entrypoint.sh" ]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
set -eu
3+
4+
if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
5+
set -- pwsh "$@"
6+
fi
7+
8+
exec "$@"

variants/6.1-git/Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM mcr.microsoft.com/powershell:6.1.3-alpine-3.8
2+
3+
# Disable telemetry for powershell 7.0.0 and above and .NET core: https://github.com/PowerShell/PowerShell/issues/16234#issuecomment-942139350
4+
ENV POWERSHELL_CLI_TELEMETRY_OPTOUT=1
5+
ENV POWERSHELL_TELEMETRY_OPTOUT=1
6+
ENV POWERSHELL_UPDATECHECK=Off
7+
ENV POWERSHELL_UPDATECHECK_OPTOUT=1
8+
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
9+
ENV DOTNET_TELEMETRY_OPTOUT=1
10+
ENV COMPlus_EnableDiagnostics=0
11+
12+
# Install Pester
13+
RUN pwsh -c 'Install-Module Pester -Scope AllUsers -MinimumVersion 4.0.0 -MaximumVersion 4.10.1 -Force -ErrorAction Stop -Verbose'
14+
RUN pwsh -c 'Install-Module Pester -Scope AllUsers -MinimumVersion 5.0.0 -Force -ErrorAction Stop -Verbose'
15+
16+
RUN apk add --no-cache git
17+
18+
COPY docker-entrypoint.sh /docker-entrypoint.sh
19+
RUN chmod +x docker-entrypoint.sh
20+
21+
ENTRYPOINT [ "/docker-entrypoint.sh" ]

variants/6.1-git/docker-entrypoint.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
set -eu
3+
4+
if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
5+
set -- pwsh "$@"
6+
fi
7+
8+
exec "$@"

variants/6.1/Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM mcr.microsoft.com/powershell:6.1.3-alpine-3.8
2+
3+
# Disable telemetry for powershell 7.0.0 and above and .NET core: https://github.com/PowerShell/PowerShell/issues/16234#issuecomment-942139350
4+
ENV POWERSHELL_CLI_TELEMETRY_OPTOUT=1
5+
ENV POWERSHELL_TELEMETRY_OPTOUT=1
6+
ENV POWERSHELL_UPDATECHECK=Off
7+
ENV POWERSHELL_UPDATECHECK_OPTOUT=1
8+
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
9+
ENV DOTNET_TELEMETRY_OPTOUT=1
10+
ENV COMPlus_EnableDiagnostics=0
11+
12+
# Install Pester
13+
RUN pwsh -c 'Install-Module Pester -Scope AllUsers -MinimumVersion 4.0.0 -MaximumVersion 4.10.1 -Force -ErrorAction Stop -Verbose'
14+
RUN pwsh -c 'Install-Module Pester -Scope AllUsers -MinimumVersion 5.0.0 -Force -ErrorAction Stop -Verbose'
15+
16+
COPY docker-entrypoint.sh /docker-entrypoint.sh
17+
RUN chmod +x docker-entrypoint.sh
18+
19+
ENTRYPOINT [ "/docker-entrypoint.sh" ]

variants/6.1/docker-entrypoint.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
set -eu
3+
4+
if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
5+
set -- pwsh "$@"
6+
fi
7+
8+
exec "$@"

0 commit comments

Comments
 (0)