Skip to content

Commit

Permalink
Merge pull request #37 from theohbrothers/enhancement/enhance-docker-…
Browse files Browse the repository at this point in the history
…entrypoint.sh-with-pwsh-flag-detection-with-fallback-on-binary

Enhancement: Enhance `/docker-entrypoint.sh` with `pwsh` flag detection with fallback on binary
  • Loading branch information
leojonathanoh authored Jun 30, 2023
2 parents 37c60ce + ba00f93 commit afda9a4
Show file tree
Hide file tree
Showing 55 changed files with 338 additions and 0 deletions.
8 changes: 8 additions & 0 deletions generate/definitions/VARIANTS.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ $VARIANTS_SHARED = @{
}
)
}
'docker-entrypoint.sh' = @{
common = $true
passes = @(
@{
variables = @{}
}
)
}
}
}
}
8 changes: 8 additions & 0 deletions generate/templates/Dockerfile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,11 @@ RUN set -eux; \
throw "Only alpine and ubuntu base image tags supported"
}
}

@"
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x docker-entrypoint.sh
ENTRYPOINT [ "/docker-entrypoint.sh" ]
"@
10 changes: 10 additions & 0 deletions generate/templates/docker-entrypoint.sh.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@'
#!/bin/sh
set -eu
if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- pwsh "$@"
fi
exec "$@"
'@
4 changes: 4 additions & 0 deletions variants/6.0.2-ubuntu-16.04-git-sops/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ RUN set -eux; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*

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.0.2-ubuntu-16.04-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 "$@"
4 changes: 4 additions & 0 deletions variants/6.0.2-ubuntu-16.04/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ ENV COMPlus_EnableDiagnostics=0
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.0.2-ubuntu-16.04/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 "$@"
4 changes: 4 additions & 0 deletions variants/6.1.3-alpine-3.8-git-sops/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ RUN set -eux; \

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.3-alpine-3.8-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 "$@"
4 changes: 4 additions & 0 deletions variants/6.1.3-alpine-3.8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ ENV COMPlus_EnableDiagnostics=0
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.3-alpine-3.8/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 "$@"
4 changes: 4 additions & 0 deletions variants/6.1.3-ubuntu-18.04-git-sops/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ RUN set -eux; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*

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.3-ubuntu-18.04-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 "$@"
4 changes: 4 additions & 0 deletions variants/6.1.3-ubuntu-18.04/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ ENV COMPlus_EnableDiagnostics=0
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.3-ubuntu-18.04/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 "$@"
4 changes: 4 additions & 0 deletions variants/6.2.4-alpine-3.8-git-sops/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ RUN set -eux; \

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.4-alpine-3.8-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 "$@"
4 changes: 4 additions & 0 deletions variants/6.2.4-alpine-3.8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ ENV COMPlus_EnableDiagnostics=0
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.4-alpine-3.8/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 "$@"
4 changes: 4 additions & 0 deletions variants/6.2.4-ubuntu-18.04-git-sops/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ RUN set -eux; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*

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.4-ubuntu-18.04-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 "$@"
4 changes: 4 additions & 0 deletions variants/6.2.4-ubuntu-18.04/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ ENV COMPlus_EnableDiagnostics=0
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.4-ubuntu-18.04/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 "$@"
4 changes: 4 additions & 0 deletions variants/7.0.3-alpine-3.9-git-sops/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ RUN set -eux; \

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.3-alpine-3.9-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 "$@"
4 changes: 4 additions & 0 deletions variants/7.0.3-alpine-3.9/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ ENV COMPlus_EnableDiagnostics=0
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.3-alpine-3.9/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 "$@"
4 changes: 4 additions & 0 deletions variants/7.0.3-ubuntu-18.04-git-sops/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ RUN set -eux; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*

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.3-ubuntu-18.04-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 "$@"
4 changes: 4 additions & 0 deletions variants/7.0.3-ubuntu-18.04/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ ENV COMPlus_EnableDiagnostics=0
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.3-ubuntu-18.04/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 "$@"
4 changes: 4 additions & 0 deletions variants/7.1.5-alpine-3.13-git-sops/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ RUN set -eux; \

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.1.5-alpine-3.13-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 "$@"
4 changes: 4 additions & 0 deletions variants/7.1.5-alpine-3.13/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ ENV COMPlus_EnableDiagnostics=0
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.1.5-alpine-3.13/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 "$@"
4 changes: 4 additions & 0 deletions variants/7.1.5-ubuntu-20.04-git-sops/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ RUN set -eux; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*

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.1.5-ubuntu-20.04-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 "$@"
4 changes: 4 additions & 0 deletions variants/7.1.5-ubuntu-20.04/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ ENV COMPlus_EnableDiagnostics=0
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.1.5-ubuntu-20.04/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 "$@"
4 changes: 4 additions & 0 deletions variants/7.2.2-alpine-3.14-git-sops/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ RUN set -eux; \

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.2.2-alpine-3.14-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 "$@"
4 changes: 4 additions & 0 deletions variants/7.2.2-alpine-3.14/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ ENV COMPlus_EnableDiagnostics=0
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.2.2-alpine-3.14/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 afda9a4

Please sign in to comment.