PSRule icon indicating copy to clipboard operation
PSRule copied to clipboard

Add walkthrough for running PSRule within a Docker container

Open BernieWhite opened this issue 7 years ago • 3 comments

Currently PSRule supports Windows using PowerShell 5.1 and above.

This is great for Windows administrators however not great for everyone else. When enabling validation within a CI/CD pipeline, the agent platform might not be Windows.

Containers provide portability and consistency which is very applicable for PSRule.

PowerShell is already available in a published Docker container.

docker pull mcr.microsoft.com/powershell

i.e.

docker run -it --rm mcr.microsoft.com/powershell

BernieWhite avatar Dec 31 '18 07:12 BernieWhite

Requires #49

BernieWhite avatar Jan 03 '19 08:01 BernieWhite

An example Dockerfile.

FROM mcr.microsoft.com/powershell:ubuntu-16.04
SHELL ["pwsh", "-command"]
RUN Install-Module -Name PSRule -AllowPrerelease -Force;
RUN Import-Module -Name PSRule;

ARG IMAGE_NAME=PSRule:0.2.0-ubuntu-16.04

LABEL maintainer="Bernie White" \
      readme.md="https://github.com/BernieWhite/PSRule/blob/master/README.md" \
      description="This Dockerfile will install the PSRule PowerShell module."

CMD [ "pwsh" ]

BernieWhite avatar Jan 10 '19 08:01 BernieWhite

At this stage providing tooling is not required. This issue should focus on documention.

BernieWhite avatar Jan 10 '19 14:01 BernieWhite