Skip to content

Commit

Permalink
Enhancement: Remove <distro> in docker tag for alpine variants
Browse files Browse the repository at this point in the history
  • Loading branch information
leojonathanoh committed Sep 20, 2023
1 parent 6dcfdeb commit 5af45ad
Show file tree
Hide file tree
Showing 40 changed files with 681 additions and 112 deletions.
186 changes: 93 additions & 93 deletions .github/workflows/ci-master-pr.yml

Large diffs are not rendered by default.

38 changes: 20 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,28 @@ Dockerized `powershell`, based on [mcr.microsoft.com/powershell](https://hub.doc

## Tags

Variants without a distro are based on `alpine`.

| Tag | Dockerfile Build Context |
|:-------:|:---------:|
| `:7.3-alpine-3.17` | [View](variants/7.3-alpine-3.17) |
| `:7.3-alpine-3.17-git` | [View](variants/7.3-alpine-3.17-git) |
| `:7.3-alpine-3.17-git-sops` | [View](variants/7.3-alpine-3.17-git-sops) |
| `:7.2-alpine-3.17` | [View](variants/7.2-alpine-3.17) |
| `:7.2-alpine-3.17-git` | [View](variants/7.2-alpine-3.17-git) |
| `:7.2-alpine-3.17-git-sops` | [View](variants/7.2-alpine-3.17-git-sops) |
| `:7.1.5-alpine-3.13` | [View](variants/7.1.5-alpine-3.13) |
| `:7.1.5-alpine-3.13-git` | [View](variants/7.1.5-alpine-3.13-git) |
| `:7.1.5-alpine-3.13-git-sops` | [View](variants/7.1.5-alpine-3.13-git-sops) |
| `:7.0.3-alpine-3.9` | [View](variants/7.0.3-alpine-3.9) |
| `:7.0.3-alpine-3.9-git` | [View](variants/7.0.3-alpine-3.9-git) |
| `:7.0.3-alpine-3.9-git-sops` | [View](variants/7.0.3-alpine-3.9-git-sops) |
| `:6.2.4-alpine-3.8` | [View](variants/6.2.4-alpine-3.8) |
| `:6.2.4-alpine-3.8-git` | [View](variants/6.2.4-alpine-3.8-git) |
| `:6.2.4-alpine-3.8-git-sops` | [View](variants/6.2.4-alpine-3.8-git-sops) |
| `:6.1.3-alpine-3.8` | [View](variants/6.1.3-alpine-3.8) |
| `:6.1.3-alpine-3.8-git` | [View](variants/6.1.3-alpine-3.8-git) |
| `:6.1.3-alpine-3.8-git-sops` | [View](variants/6.1.3-alpine-3.8-git-sops) |
| `:7.3` | [View](variants/7.3) |
| `:7.3-git` | [View](variants/7.3-git) |
| `:7.3-git-sops` | [View](variants/7.3-git-sops) |
| `:7.2` | [View](variants/7.2) |
| `:7.2-git` | [View](variants/7.2-git) |
| `:7.2-git-sops` | [View](variants/7.2-git-sops) |
| `:7.1` | [View](variants/7.1) |
| `:7.1-git` | [View](variants/7.1-git) |
| `:7.1-git-sops` | [View](variants/7.1-git-sops) |
| `:7.0` | [View](variants/7.0) |
| `:7.0-git` | [View](variants/7.0-git) |
| `:7.0-git-sops` | [View](variants/7.0-git-sops) |
| `:6.2` | [View](variants/6.2) |
| `:6.2-git` | [View](variants/6.2-git) |
| `:6.2-git-sops` | [View](variants/6.2-git-sops) |
| `:6.1` | [View](variants/6.1) |
| `:6.1-git` | [View](variants/6.1-git) |
| `:6.1-git-sops` | [View](variants/6.1-git-sops) |
| `:7.3-ubuntu-22.04`, `:latest` | [View](variants/7.3-ubuntu-22.04) |
| `:7.3-ubuntu-22.04-git` | [View](variants/7.3-ubuntu-22.04-git) |
| `:7.3-ubuntu-22.04-git-sops` | [View](variants/7.3-ubuntu-22.04-git-sops) |
Expand Down
9 changes: 8 additions & 1 deletion generate/definitions/VARIANTS.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,14 @@ $VARIANTS = @(
}
# Docker image tag. E.g. '7.1.5-alpine-3.13'
tag = @(
$variant['base_image_tag'] -replace '^lts-', '' -replace '-\d{8}$', '' # Replace 'lts-' prefix and 8-digit calver suffix
if ($variant['base_image_tag'] -match '^(lts-)?(\d+\.\d+)(\.\d+)?-(alpine|ubuntu)-(\d+\.\d+)') {
if ($matches[4] -eq 'alpine') {
$matches[2] # Only the version number
}
if ($matches[4] -eq 'ubuntu') {
"$( $matches[2] )$( $matches[3] )-$( $matches[4] )-$( $matches[5] )" # Strip 'lts-' prefix and 8-digit calver suffix
}
}
$subVariant['components'] | ? { $_ }
) -join '-'
tag_as_latest = if ($variant['base_image_tag'] -eq $local:BASE_IMAGE_TAG_LATEST_STABLE -and $subVariant['components'].Count -eq 0) { $true } else { $false }
Expand Down
2 changes: 2 additions & 0 deletions generate/templates/README.md.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Dockerized ``powershell``, based on [mcr.microsoft.com/powershell](https://hub.d
## Tags
Variants without a distro are based on ``alpine``.
| Tag | Dockerfile Build Context |
|:-------:|:---------:|
$(
Expand Down
29 changes: 29 additions & 0 deletions variants/6.1-git-sops/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM mcr.microsoft.com/powershell:6.1.3-alpine-3.8

# Disable telemetry for powershell 7.0.0 and above and .NET core: https://github.com/PowerShell/PowerShell/issues/16234#issuecomment-942139350
ENV POWERSHELL_CLI_TELEMETRY_OPTOUT=1
ENV POWERSHELL_TELEMETRY_OPTOUT=1
ENV POWERSHELL_UPDATECHECK=Off
ENV POWERSHELL_UPDATECHECK_OPTOUT=1
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
ENV DOTNET_TELEMETRY_OPTOUT=1
ENV COMPlus_EnableDiagnostics=0

# Install Pester
RUN pwsh -c 'Install-Module Pester -Scope AllUsers -MinimumVersion 4.0.0 -MaximumVersion 4.10.1 -Force -ErrorAction Stop -Verbose'
RUN pwsh -c 'Install-Module Pester -Scope AllUsers -MinimumVersion 5.0.0 -Force -ErrorAction Stop -Verbose'

RUN apk add --no-cache git

RUN set -eux; \
wget -qO- https://github.com/mozilla/sops/releases/download/v3.7.1/sops-v3.7.1.linux > /usr/local/bin/sops; \
chmod +x /usr/local/bin/sops; \
sha256sum /usr/local/bin/sops | grep '^185348fd77fc160d5bdf3cd20ecbc796163504fd3df196d7cb29000773657b74 '; \
sops --version

RUN apk add --no-cache gnupg

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x docker-entrypoint.sh

ENTRYPOINT [ "/docker-entrypoint.sh" ]
8 changes: 8 additions & 0 deletions variants/6.1-git-sops/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- pwsh "$@"
fi

exec "$@"
21 changes: 21 additions & 0 deletions variants/6.1-git/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM mcr.microsoft.com/powershell:6.1.3-alpine-3.8

# Disable telemetry for powershell 7.0.0 and above and .NET core: https://github.com/PowerShell/PowerShell/issues/16234#issuecomment-942139350
ENV POWERSHELL_CLI_TELEMETRY_OPTOUT=1
ENV POWERSHELL_TELEMETRY_OPTOUT=1
ENV POWERSHELL_UPDATECHECK=Off
ENV POWERSHELL_UPDATECHECK_OPTOUT=1
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
ENV DOTNET_TELEMETRY_OPTOUT=1
ENV COMPlus_EnableDiagnostics=0

# Install Pester
RUN pwsh -c 'Install-Module Pester -Scope AllUsers -MinimumVersion 4.0.0 -MaximumVersion 4.10.1 -Force -ErrorAction Stop -Verbose'
RUN pwsh -c 'Install-Module Pester -Scope AllUsers -MinimumVersion 5.0.0 -Force -ErrorAction Stop -Verbose'

RUN apk add --no-cache git

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x docker-entrypoint.sh

ENTRYPOINT [ "/docker-entrypoint.sh" ]
8 changes: 8 additions & 0 deletions variants/6.1-git/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- pwsh "$@"
fi

exec "$@"
19 changes: 19 additions & 0 deletions variants/6.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM mcr.microsoft.com/powershell:6.1.3-alpine-3.8

# Disable telemetry for powershell 7.0.0 and above and .NET core: https://github.com/PowerShell/PowerShell/issues/16234#issuecomment-942139350
ENV POWERSHELL_CLI_TELEMETRY_OPTOUT=1
ENV POWERSHELL_TELEMETRY_OPTOUT=1
ENV POWERSHELL_UPDATECHECK=Off
ENV POWERSHELL_UPDATECHECK_OPTOUT=1
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
ENV DOTNET_TELEMETRY_OPTOUT=1
ENV COMPlus_EnableDiagnostics=0

# Install Pester
RUN pwsh -c 'Install-Module Pester -Scope AllUsers -MinimumVersion 4.0.0 -MaximumVersion 4.10.1 -Force -ErrorAction Stop -Verbose'
RUN pwsh -c 'Install-Module Pester -Scope AllUsers -MinimumVersion 5.0.0 -Force -ErrorAction Stop -Verbose'

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x docker-entrypoint.sh

ENTRYPOINT [ "/docker-entrypoint.sh" ]
8 changes: 8 additions & 0 deletions variants/6.1/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- pwsh "$@"
fi

exec "$@"
29 changes: 29 additions & 0 deletions variants/6.2-git-sops/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM mcr.microsoft.com/powershell:6.2.4-alpine-3.8

# Disable telemetry for powershell 7.0.0 and above and .NET core: https://github.com/PowerShell/PowerShell/issues/16234#issuecomment-942139350
ENV POWERSHELL_CLI_TELEMETRY_OPTOUT=1
ENV POWERSHELL_TELEMETRY_OPTOUT=1
ENV POWERSHELL_UPDATECHECK=Off
ENV POWERSHELL_UPDATECHECK_OPTOUT=1
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
ENV DOTNET_TELEMETRY_OPTOUT=1
ENV COMPlus_EnableDiagnostics=0

# Install Pester
RUN pwsh -c 'Install-Module Pester -Scope AllUsers -MinimumVersion 4.0.0 -MaximumVersion 4.10.1 -Force -ErrorAction Stop -Verbose'
RUN pwsh -c 'Install-Module Pester -Scope AllUsers -MinimumVersion 5.0.0 -Force -ErrorAction Stop -Verbose'

RUN apk add --no-cache git

RUN set -eux; \
wget -qO- https://github.com/mozilla/sops/releases/download/v3.7.1/sops-v3.7.1.linux > /usr/local/bin/sops; \
chmod +x /usr/local/bin/sops; \
sha256sum /usr/local/bin/sops | grep '^185348fd77fc160d5bdf3cd20ecbc796163504fd3df196d7cb29000773657b74 '; \
sops --version

RUN apk add --no-cache gnupg

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x docker-entrypoint.sh

ENTRYPOINT [ "/docker-entrypoint.sh" ]
8 changes: 8 additions & 0 deletions variants/6.2-git-sops/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- pwsh "$@"
fi

exec "$@"
21 changes: 21 additions & 0 deletions variants/6.2-git/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM mcr.microsoft.com/powershell:6.2.4-alpine-3.8

# Disable telemetry for powershell 7.0.0 and above and .NET core: https://github.com/PowerShell/PowerShell/issues/16234#issuecomment-942139350
ENV POWERSHELL_CLI_TELEMETRY_OPTOUT=1
ENV POWERSHELL_TELEMETRY_OPTOUT=1
ENV POWERSHELL_UPDATECHECK=Off
ENV POWERSHELL_UPDATECHECK_OPTOUT=1
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
ENV DOTNET_TELEMETRY_OPTOUT=1
ENV COMPlus_EnableDiagnostics=0

# Install Pester
RUN pwsh -c 'Install-Module Pester -Scope AllUsers -MinimumVersion 4.0.0 -MaximumVersion 4.10.1 -Force -ErrorAction Stop -Verbose'
RUN pwsh -c 'Install-Module Pester -Scope AllUsers -MinimumVersion 5.0.0 -Force -ErrorAction Stop -Verbose'

RUN apk add --no-cache git

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x docker-entrypoint.sh

ENTRYPOINT [ "/docker-entrypoint.sh" ]
8 changes: 8 additions & 0 deletions variants/6.2-git/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- pwsh "$@"
fi

exec "$@"
19 changes: 19 additions & 0 deletions variants/6.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM mcr.microsoft.com/powershell:6.2.4-alpine-3.8

# Disable telemetry for powershell 7.0.0 and above and .NET core: https://github.com/PowerShell/PowerShell/issues/16234#issuecomment-942139350
ENV POWERSHELL_CLI_TELEMETRY_OPTOUT=1
ENV POWERSHELL_TELEMETRY_OPTOUT=1
ENV POWERSHELL_UPDATECHECK=Off
ENV POWERSHELL_UPDATECHECK_OPTOUT=1
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
ENV DOTNET_TELEMETRY_OPTOUT=1
ENV COMPlus_EnableDiagnostics=0

# Install Pester
RUN pwsh -c 'Install-Module Pester -Scope AllUsers -MinimumVersion 4.0.0 -MaximumVersion 4.10.1 -Force -ErrorAction Stop -Verbose'
RUN pwsh -c 'Install-Module Pester -Scope AllUsers -MinimumVersion 5.0.0 -Force -ErrorAction Stop -Verbose'

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x docker-entrypoint.sh

ENTRYPOINT [ "/docker-entrypoint.sh" ]
8 changes: 8 additions & 0 deletions variants/6.2/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- pwsh "$@"
fi

exec "$@"
29 changes: 29 additions & 0 deletions variants/7.0-git-sops/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM mcr.microsoft.com/powershell:7.0.3-alpine-3.9-20200928

# Disable telemetry for powershell 7.0.0 and above and .NET core: https://github.com/PowerShell/PowerShell/issues/16234#issuecomment-942139350
ENV POWERSHELL_CLI_TELEMETRY_OPTOUT=1
ENV POWERSHELL_TELEMETRY_OPTOUT=1
ENV POWERSHELL_UPDATECHECK=Off
ENV POWERSHELL_UPDATECHECK_OPTOUT=1
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
ENV DOTNET_TELEMETRY_OPTOUT=1
ENV COMPlus_EnableDiagnostics=0

# Install Pester
RUN pwsh -c 'Install-Module Pester -Scope AllUsers -MinimumVersion 4.0.0 -MaximumVersion 4.10.1 -Force -ErrorAction Stop -Verbose'
RUN pwsh -c 'Install-Module Pester -Scope AllUsers -MinimumVersion 5.0.0 -Force -ErrorAction Stop -Verbose'

RUN apk add --no-cache git

RUN set -eux; \
wget -qO- https://github.com/mozilla/sops/releases/download/v3.7.1/sops-v3.7.1.linux > /usr/local/bin/sops; \
chmod +x /usr/local/bin/sops; \
sha256sum /usr/local/bin/sops | grep '^185348fd77fc160d5bdf3cd20ecbc796163504fd3df196d7cb29000773657b74 '; \
sops --version

RUN apk add --no-cache gnupg

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x docker-entrypoint.sh

ENTRYPOINT [ "/docker-entrypoint.sh" ]
8 changes: 8 additions & 0 deletions variants/7.0-git-sops/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- pwsh "$@"
fi

exec "$@"
21 changes: 21 additions & 0 deletions variants/7.0-git/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM mcr.microsoft.com/powershell:7.0.3-alpine-3.9-20200928

# Disable telemetry for powershell 7.0.0 and above and .NET core: https://github.com/PowerShell/PowerShell/issues/16234#issuecomment-942139350
ENV POWERSHELL_CLI_TELEMETRY_OPTOUT=1
ENV POWERSHELL_TELEMETRY_OPTOUT=1
ENV POWERSHELL_UPDATECHECK=Off
ENV POWERSHELL_UPDATECHECK_OPTOUT=1
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
ENV DOTNET_TELEMETRY_OPTOUT=1
ENV COMPlus_EnableDiagnostics=0

# Install Pester
RUN pwsh -c 'Install-Module Pester -Scope AllUsers -MinimumVersion 4.0.0 -MaximumVersion 4.10.1 -Force -ErrorAction Stop -Verbose'
RUN pwsh -c 'Install-Module Pester -Scope AllUsers -MinimumVersion 5.0.0 -Force -ErrorAction Stop -Verbose'

RUN apk add --no-cache git

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x docker-entrypoint.sh

ENTRYPOINT [ "/docker-entrypoint.sh" ]
8 changes: 8 additions & 0 deletions variants/7.0-git/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- pwsh "$@"
fi

exec "$@"
19 changes: 19 additions & 0 deletions variants/7.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM mcr.microsoft.com/powershell:7.0.3-alpine-3.9-20200928

# Disable telemetry for powershell 7.0.0 and above and .NET core: https://github.com/PowerShell/PowerShell/issues/16234#issuecomment-942139350
ENV POWERSHELL_CLI_TELEMETRY_OPTOUT=1
ENV POWERSHELL_TELEMETRY_OPTOUT=1
ENV POWERSHELL_UPDATECHECK=Off
ENV POWERSHELL_UPDATECHECK_OPTOUT=1
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
ENV DOTNET_TELEMETRY_OPTOUT=1
ENV COMPlus_EnableDiagnostics=0

# Install Pester
RUN pwsh -c 'Install-Module Pester -Scope AllUsers -MinimumVersion 4.0.0 -MaximumVersion 4.10.1 -Force -ErrorAction Stop -Verbose'
RUN pwsh -c 'Install-Module Pester -Scope AllUsers -MinimumVersion 5.0.0 -Force -ErrorAction Stop -Verbose'

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x docker-entrypoint.sh

ENTRYPOINT [ "/docker-entrypoint.sh" ]
8 changes: 8 additions & 0 deletions variants/7.0/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- pwsh "$@"
fi

exec "$@"
Loading

0 comments on commit 5af45ad

Please sign in to comment.